当前位置: 代码迷 >> SQL >> sql server 2005队列转换
  详细解决方案

sql server 2005队列转换

热度:55   发布时间:2016-05-05 14:45:55.0
sql server 2005行列转换

select p.*,p.[2010-08-14]-p.[2010-08-12] as detal from(SELECT city_id,day_id,bar_cnt_active FROM [ISP].[barstat].[RPT_CITY_BAR_CNT_BYDAY]where day_id between '2010-08-12' and '2010-08-14'and city_id in (547,548) ) t pivot(max(bar_cnt_active) for day_id in ([2010-08-12],[2010-08-13],[2010-08-14])) as p
?
  相关解决方案