比如有一张学生表,一张订单表
问题一:统计所有的学生数和所有的男学生数
select count(id) as 'total', count(if(gender = 0, 1, null)) as 'male' from student;
问题二:统计订单表的订单金额,以及商品订单的订单金额
select sum(order_amount) as 'total', sum(if(order_type = '01', order_amount, null)) as 'goodsOrder' from order;