0
我需要的SQL查詢轉換表1到表2在sql中更改表格單元格但如何?
select Count(Page) as VisitingCount,CONVERT(VARCHAR(5),Date, 108) as [Time] from scr_SecuristLog
where Date between '2009-04-30' and '2009-05-02'
and [user] in(select USERNAME
from scr_CustomerAuthorities where customerID=Convert(varchar,4) and ID=Convert(varchar,43))
group by CONVERT(VARCHAR(5),Date, 108) order by CONVERT(VARCHAR(5),Date, 108) asc
表1
VisitingCount日期1 ---------------- --- 15:09
3 ------------------- 15:10
7 ---------------- --- 15:15
1 ------------------- 15:39
2 ------------------- 15:40
3 ------------------- 15:47
我怎樣才能改變見下表
此表
表2
VisitingCount Date11 ------------------- 15:00-15:30
6 -------------- ----- 15:30-16:00
您可以在不使用臨時表的情況下執行此操作,僅通過在相同的CASE語句上進行分組並執行計數 – 2009-05-05 14:46:27