Quantcast
Channel: Answers for "Distinct sums of case statements"
Browsing index pages (6 articles)

Answer by Beandon10

If you don't need the separate dates in columns, you could write the query as: DECLARE @Emp TABLE ( EmpID INT, hist_date DATETIME ) INSERT @Emp(EmpID, hist_date) VALUES (132, '7/1/2012'), (143,...

View Article


Answer by Kevin Feasel

This is a two-step problem that you can solve with ROW_NUMBER. Here's a sample solution: declare @table table ( empid int, hist_date date ); insert into @table(empid, hist_date) values (132,...

View Article


Answer by Tim

Try adding a group by. Without a dataset in front of me I would try a group by month(hist_date)

View Article

Answer by Beandon10

If you don't need the separate dates in columns, you could write the query as: DECLARE @Emp TABLE ( EmpID INT, hist_date DATETIME ) INSERT @Emp(EmpID, hist_date) VALUES (132, '7/1/2012'), (143,...

View Article

Answer by Kevin Feasel

This is a two-step problem that you can solve with ROW_NUMBER. Here's a sample solution: declare @table table ( empid int, hist_date date ); insert into @table(empid, hist_date) values (132,...

View Article


Answer by Tim

Try adding a group by. Without a dataset in front of me I would try a group by month(hist_date)

View Article
Browsing index pages (6 articles)


Latest Images