September 4, 2016 at 1:10 pm
I've the following table:
department - student - start_date - end_date
1 102 2016-01-01 2016-01-03
1 102 2016-01-04 2016-01-07
1 102 2016-01-08 2016-01-11
1 102 2016-01-12 2016-01-14
1 104 2016-01-15 2016-01-17
1 104 2016-01-18 2016-01-20
My expected output would be as follows:
department - student - start_date - end_date
1 102 2016-01-01 2016-01-14
1 104 2016-01-15 2016-01-20
I've tried to use min/max in the select query using group by. But it didn't work. Any idea to do the above?
September 4, 2016 at 1:43 pm
I've tried to use min/max in the select query using group by. But it didn't work
please post code that didnt work......min/max with group by does work
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
September 4, 2016 at 9:38 pm
I tried something like this as follows:
SELECT Department, Student, Min(Start_date) AS Start_date, Max(End_date) AS End_date FROM Table GROUP BY
Student
Now it worked. Thanks for your cooperation.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply