码迷,mamicode.com
首页 > 数据库 > 详细

sql查询,如何增加一列

时间:2014-12-25 14:25:22      阅读:278      评论:0      收藏:0      [点我收藏+]

标签:

select * from (
select ‘finish_order_info‘ as table_name,count(1)as num from fraudorder.finish_order_info where crt_dt between to_date(‘2014-12-24:00:00:00‘,‘yyyy-mm-dd,hh24:mi:ss‘) and to_date(‘2014-12-25:00:00:00‘) group by ‘finish‘ union all
select ‘discard_order_info‘ as table_name, count(1)as num from FRAUDORDER.discard_order_info where crt_dt between to_date(‘2014-12-24:00:00:00‘,‘yyyy-mm-dd,hh24:mi:ss‘) and to_date(‘2014-12-25:00:00:00‘)union all
select ‘raw_air_order_info‘ as table_name, count(1)as num from FRAUDORDER.raw_air_order_info where crt_dt between to_date(‘2014-12-24:00:00:00‘,‘yyyy-mm-dd,hh24:mi:ss‘) and to_date(‘2014-12-25:00:00:00‘)union all
select ‘app_air_order_info‘ as table_name, count(1)as num from FRAUDORDER.app_air_order_info where crt_dt between to_date(‘2014-12-24:00:00:00‘,‘yyyy-mm-dd,hh24:mi:ss‘) and to_date(‘2014-12-25:00:00:00‘)union all
select ‘unkown_order_info‘ as table_name, count(1)as num from FRAUDORDER.unkown_order_info where crt_dt between to_date(‘2014-12-24:00:00:00‘,‘yyyy-mm-dd,hh24:mi:ss‘) and to_date(‘2014-12-25:00:00:00‘)
);

sql查询,如何增加一列

标签:

原文地址:http://www.cnblogs.com/lengfengzhizhe/p/4184485.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!