子查询

SELECT
a.sm AS "1",
b.sm AS "1",
c.sm AS "1",
d.sm AS "1",
e.sm AS "1",
f.sm AS "1",
g.sm AS "1",
h.sm AS "1"
FROM
(select IFNULL(sum(amount),0)*100 sm from 1 where uid = 1and item_type in(10,11) and amount < 0) a ,
(select IFNULL(sum(amount),0)*100 sm from 1 where uid = 1and item_type in(10,11) and amount < 0) b ,
(select IFNULL(sum(amount),0)*100 sm from 1 where uid = 1and item_type in(10,11) and amount < 0) c ,
(select IFNULL(sum(amount),0)*100 sm from 1  where uid = 1and item_type in(10,11) and amount < 0) d ,
(select IFNULL(sum(amount),0)*100 sm from 1 where uid = 1and item_type in(18) and amount < 0) e ,
(select IFNULL(sum(amount),0)*100 sm from x where uid = 1and item_type in(18) and amount < 0) f ,
(select IFNULL(sum(amount),0)*100 sm from x where uid = 1and item_type in(18) and amount < 0) g ,
(select IFNULL(sum(amount),0)*100 sm from x where uid = 1and item_type in(18) and amount < 0) h

posted @ 2018-02-07 09:22  brady-wang  阅读(278)  评论(0编辑  收藏  举报