sql - Group a Count by Date on SSMS -
i have tried searching not sure right term i'm looking may have missed it.
my current query looks following:
select [assigned user], formtitle, dateissued, count(orbitref) total form_common dateissued >= dateadd(d, -28, getdate()) , visits = '1' , lastoutcome = 'card left' group [assigned user], formtitle, dateissued order count(orbitref) desc
this returns users , count have got 1 visit , outcome. gives me list expect. , every date adds row in dateissued
column.
what want show following groups count under date on each row , each date column date:
assigned user | formtitle | 2017-04-09 | 2017-04-11 | 2017-04-18 john smith | v1.3.2 | 4 | 56 | 5 dave barry | v1.0.2 | 1 | 2 | 0
i wondering if have use have table of table within query? have done before not splitting date out column each date.
fyi dates week commencing there wouldn't loads. 4 different ones month 1 person has when run last week, end of next week should of reduced, need track on time.
apologies, it's difficult 1 explain , think have fried brain @ point , way on thinking it. using ssms v.2016
Comments
Post a Comment