sql - Pulling content for weekly data -
sql - Pulling content for weekly data -
i have been tasked pulling data, each week. count needs restart each mon , ends friday.
select count(*) piececount smallpainttransferconveyorfloat
datepart allow filter week
if have column date in table can utilize :
select count(*) piececount smallpainttransferconveyorfloat grouping datepart(wk, <date_column_name>), datepart(year, <date_column_name>)
replace 2nd parameter right column name on table
here's short sqlfiddle illustration : http://sqlfiddle.com/#!6/a92ad/4/0
edit
add datepart(year, date_column_name) remove unwanted merge if info cover more year
sql
Comments
Post a Comment