mysql join带条件查询

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 JOINful_ky_contract cONc.id=o.contract_idLEFT JOINful_custom cuONc.custom_id=cu.idleft join ful_admin_userauONau.id=cu.user_id where au.name like "%张俊君%";

mysql join带条件查询
等同于

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 JOINful_ky_contract cONc.id=o.contract_idLEFT JOINful_custom cuONc.custom_id=cu.idjoin (select * from ful_admin_user where name like "%张俊君%")auONau.id=cu.user_id;

上一篇:JavaScript中对象属性的描述,可枚举,可配置,可重写...你了解过吗?


下一篇:JavaScript的第七种数据类型,Symbol的作用,Symbol.iterator与for...of