Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting Dates in Access

Status
Not open for further replies.

ShirleyLundquist

Technical User
Jan 27, 2000
1
US
I have a list of birthdays that I want sorted January to December and if possible by day also ... so the birthdays are sequential. Year doesn't matter. I have done it before but can't remember what to do now.
 
Create a query where you take apart month and date with DatePart-function and then sort by month part and day part. Looks in SQL like this:<br>
<br>
SELECT YourBirthdayField, DatePart(&quot;m&quot;,[YourBirthdayField]) AS BirthMonth, DatePart(&quot;d&quot;,[YourBirthdayField]) AS BirthDate <br>
FROM [YourTable]<br>
ORDER BY DatePart(&quot;m&quot;,[YourBirthdayField]), DatePart(&quot;d&quot;,[YourBirthdayField]);<br>
<br>
Al
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top