Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Order By
Message
From
26/01/2003 10:29:14
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00745530
Message ID:
00745535
Views:
21
This message has been marked as the solution to the initial question of the thread.
Mel, just ORDER BY MyTable.HiredDate would order in correct chronological order Year-Month-Day. Or have I misunderstood the question? If you want to exclude the year from the HiredDate to get all month/day records together then you could use the following as a possible solution:

SELECT Fld1, Fld2, FldX, SUBSTR( DTOS( MyTable.HiredDate ), 5 ) AS MnthDay FROM MyTable ORDER BY MnthDay

Another option could be:

SELECT Fld1, Fld2, FldX, MONTH( HiredDate ) AS nMonth, DAY( HiredDate ) AS nDAY FROM MyTable ORDER BY nMonth, nDay


>In building a Select-SQL statement, I need the Order By to actaully be ordered by the Month and then Day of a date field similar to:
>
>Order By MONTH(MyTable.HiredDate), DAY(MyTable.HiredDate)
>
>Anyone know how to do something like this?
>
>I would prefer not to have to create a temp index to do this.
>
>Thanks,
>Mel Cummings
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform