cullie140
12-06-2009, 05:12 PM
Here is the problem. I have a table with columns for [StartDate],[EndDate],[Deadline] all of which are datetime fields. I want to display these entries in a calendar. Since the deadline is often much earlier than the event I need to display the event until the deadline is passed and then again in the correct order by its start date. I decided to use Union All to get duplicate entries when there is a deadline but I am confused on how to get the sort right.
Select * from table1 Where StartDate <= 'lastdate' AND EndDate >= 'firstdate'
Union All
Select * from table1 Where Deadline >= 'lastdate' AND Deadline >= 'firstdate'
What I need to do is where there are duplicates sort the first record by deadline and then the second record by StartDate. This should produce two entries in the calendar once for the deadline and once for the actual event int the correct chronological order.
Thanks
Select * from table1 Where StartDate <= 'lastdate' AND EndDate >= 'firstdate'
Union All
Select * from table1 Where Deadline >= 'lastdate' AND Deadline >= 'firstdate'
What I need to do is where there are duplicates sort the first record by deadline and then the second record by StartDate. This should produce two entries in the calendar once for the deadline and once for the actual event int the correct chronological order.
Thanks