I have this information from a Table: The due date day and month (eg. 16/11 for 16th November) of events that repeat every year.
I need to create a View, sorted by how far it is in the future.
(eg. If it is currently 16 Nov 2010, then 31/12 means 31 Dec 2010 and it comes before 1/1 which means 1 Jan 2011)
Let’s assume the Event table has these 3 columns
|------------------------|
| Event |
|------------------------|
| ID | DueDay | DueMonth |
|------------------------|
Thanks in advance!
Any event in the table with a dues day/month ahead of current day/month will occur *this*year. Any event with a due day/month behind current day/month will occur next year. Any event due next year is further than any event due this year.
Now that being said, what you ask for is not possible because you ask for
...a View, sorted by...which is a concept that does not exists. Views are not sorted. Only queries are sorted. So you can create a view that projects the proper event date and then the query from the view must use ORDER BY to get the events sorted by event date:To get the events by order, the query must include an order by: