mysql三目运算符&子查询

mysql三目运算
1 select sum(CASE WHEN changeWeight = -1 THEN price * ((weight * goodsNumber) / 500) ELSE  price * ((changeWeight) / 500) ENDas amount from tableA

mysql子查询
1 SELECT order_info.*,(SELECT count(*) FROM order_detail where order_detail.orderID = order_info.orderID ) as orderCount FROM order_info WHERE storeIDin (SELECT storeID FROM store_info WHERE status = 0)

你可能感兴趣的:(php,mysql)