日期:2014-05-17  浏览次数:20738 次

从1个表里取出多条数据,需要按列输出,谢谢!
现在用的语句是:但输出结果是行
SELECT  
(select   count(*)   from   BILL.T_SI_EXTERNAL_ID   WHERE   STATUS   =   0   AND   LATN_ID=634   AND   SI_EXTERNAL_ID   LIKE   '301% '   AND   SI_EXTERNAL_ID   NOT   LIKE   '%p '),
(select   count(*)   from   BILL.T_SI_EXTERNAL_ID   WHERE   STATUS   =   0   AND   LATN_ID=634   AND   SI_EXTERNAL_ID   LIKE   '6020% '   AND   SI_EXTERNAL_ID   NOT   LIKE   '%p '),
(select   count(*)   from   BILL.T_SI_EXTERNAL_ID   WHERE   STATUS   =   0   AND   LATN_ID=634   AND   SI_EXTERNAL_ID   LIKE   '6022% '   AND   SI_EXTERNAL_ID   NOT   LIKE   '%p ')
FROM   DUAL


请帮忙!


------解决方案--------------------

(select count(*) from BILL.T_SI_EXTERNAL_ID WHERE STATUS = 0 AND LATN_ID=634 AND SI_EXTERNAL_ID LIKE '301% ' AND SI_EXTERNAL_ID NOT LIKE '%p ')
union
(select count(*) from BILL.T_SI_EXTERNAL_ID WHERE STATUS = 0 AND LATN_ID=634 AND SI_EXTERNAL_ID LIKE '6020% ' AND SI_EXTERNAL_ID NOT LIKE '%p ')
union
(select count(*) from BILL.T_SI_EXTERNAL_ID WHERE STATUS = 0 AND LATN_ID=634 AND SI_EXTERNAL_ID LIKE '6022% ' AND SI_EXTERNAL_ID NOT LIKE '%p ')