SELECT count(if(o.order_status=1,1,null)) as "symbol_1",count(if(o.order_status=2,1,null)) as "symbol_2",count(if(o.order_status=3,1,null)) as "symbol_3",count(if(o.order_status=4,1,null)) as "symbol_4",count(if(o.order_status=5,1,null)) as "symbol_5",count(if(o.order_status=6,1,null)) as "symbol_6",count(if(o.order_status=7,1,null)) as "symbol_7" FROM
ful_ky_order
oLEFT JOIN
ful_ky_contract
cON
c.
id=
o.
contract_idLEFT JOIN
ful_custom
cuON
c.
custom_id=
cu.
idleft join ful_admin_user
auON
au.
id=
cu.
user_id where au.name like "%张俊君%";
等同于
SELECT count(if(o.order_status=1,1,null)) as "symbol_1",count(if(o.order_status=2,1,null)) as "symbol_2",count(if(o.order_status=3,1,null)) as "symbol_3",count(if(o.order_status=4,1,null)) as "symbol_4",count(if(o.order_status=5,1,null)) as "symbol_5",count(if(o.order_status=6,1,null)) as "symbol_6",count(if(o.order_status=7,1,null)) as "symbol_7" FROM
ful_ky_order
oLEFT JOIN
ful_ky_contract
cON
c.
id=
o.
contract_idLEFT JOIN
ful_custom
cuON
c.
custom_id=
cu.
idjoin (select * from ful_admin_user where name like "%张俊君%")
auON
au.
id=
cu.
user_id;