mysql - I m not be able to get correct number of order_status -


i m trying count of order_registration.status using in join table

select dstr_operator_master.*,  count(order_registration.status like'%enquiry%') order_status,  count(order_registration.pname) destilist  dstr_operator_master  left join order_registration  on find_in_set( order_registration.user_id , dstr_operator_master.u_id)  dstr_operator_master.status = '1'  , dstr_operator_master.type ='distributor'  group dstr_operator_master.auto_id 

try this:

select d.*,         sum(case when o.status '%enquiry%' 1 else 0 end) order_status,         count(o.pname) destilist    dstr_operator_master d left join order_registration o on find_in_set(o.user_id, d.u_id)  d.status = '1' , d.type = 'distributor'  group d.auto_id; 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -