質問

私は、以下のクエリするの数を返します。 質問/各日StackOverflowの2011年.用していただきたいと思います。質問に期2011.これを使用してい ROLLUP.

select 
  year(p.CreationDate) as [Year],
  month(p.CreationDate) as [Month],
  day(p.CreationDate) as [Day],
  count(*) as [QuestionsAskedToday]
from Posts p 
  inner join PostTags pt on p.id = pt.postid
  inner join Tags t on t.id = pt.tagid
where 
  t.tagname = 'android' and
  p.CreationDate > '2011-01-01 00:00:00'
group by year(p.CreationDate), month(p.CreationDate),day(p.CreationDate)
​with rollup
order by year(p.CreationDate), month(p.CreationDate) desc,day(p.CreationDate) desc​

これは、出力:

output

全ての質問にそれぞれの日における2011年は表示されているのQuestionsAskedToday列そのものです。

があるので、表示、rollupを新しいカラムエイリアス?

リンクのクエリ

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top