Skip to content

Instantly share code, notes, and snippets.

@spara
Created January 26, 2016 22:00
Show Gist options
  • Save spara/420619eff3a19519a283 to your computer and use it in GitHub Desktop.
Save spara/420619eff3a19519a283 to your computer and use it in GitHub Desktop.
query stackexchange data explorer
select [Month], Title, id, [link], ViewCount, Score from
(
select CAST(
cast(DATEPART(YYYY, CreationDate) as varchar) + '-' + cast(DATEPART(MM, CreationDate) as varchar) + '-01'
as datetime) [Month],
Title,
p.Id,
'https://stackoverflow.com/questions/' + CAST(p.Id AS nvarchar) [link],
ViewCount,
Score
from Posts p
join PostTags pt on pt.PostId = p.Id
join Tags t on t.Id = pt.TagId
where TagName LIKE '%kubernetes%'
-- and CreationDate >= convert(datetime, 'Jan 08 2016')
group by p.id, p.CreationDate, Title, ViewCount, Score
) as X
order by [Month] asc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment