Select TRUNC(create_dtime) as Day, Count(Create_Dtime) As SinS_Tot
From player_chkin_hist
Where Product_Id Is Not Null
And Trunc(Create_Dtime) >= To_Date('2012-sep-01','yyyy-mon-dd')
And Trunc(Create_Dtime) < To_Date('2012-sep-19','yyyy-mon-dd')
Group By Trunc(Create_Dtime)
Order By 1 Asc
和
Select TRUNC(Create_Dtime) As Day, Count(Create_Dtime) As Sins_Tot
From Player_Chkin
where Product_Id Is Not Null
And Trunc(Create_Dtime) >= To_Date('2012-sep-01','yyyy-mon-dd')
And Trunc(Create_Dtime) < To_Date('2012-sep-19','yyyy-mon-dd')
Group By Trunc(Create_Dtime)
Order By 1 Asc
查询在1个结果:
Day SinS_Tot
01-Sep-12 10000
02-Sep-12 9000
查询的两个结果:
Day SinS_Tot
03-Sep-12 11500
04-Sep-12 9800
有没有简单的方法来组合这两个查询,以便我可以看到所有数据?我想过使用连接,但由于日期不重叠,所以不会有任何内容连接设置为等于。
2012-09-18
Americo
+0
使用'UNION ALL'如果你想保持副本或'UNION' –