我有一张桌子
folders:
- map: ~/Code // this one
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public // and this one
我想要结果
id | amount | type
1 | 2000 | cr
2 | 3000 | cr
3 | 4000 | dr
使用单个MySQL dr | cr
4000 | 5000
查询。
怎么做?
答案 0 :(得分:0)
select sum(amount) as amount, type from [your table] group by type
答案 1 :(得分:0)
select (select count(amount) from table_name where type='dr') as dr,
(select count(amount) from table_name where type='cr') as cr from table_name;
希望它有所帮助。 :)