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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting Day in Date in Printing Reports

Status
Not open for further replies.

Wendz

Programmer
Aug 9, 2000
47
0
0
PH
Visit site
Hello To All,

I have a question regarding day of week in reports. I am making a report for birthday celebrants and I have filtered it according to the months of the birthday celebrants. My problem is how I am gonna sort the days of the birthdate like; 01/12/1990, 01/02/1989 and 01/13/1998. How I'm gonna sort it on the reports that it will display the date in order like 01/02/1989, 01/12/1990. Thanks a lot for your help...

Wendz
 
While your examples aren't clear enough to really know the exact order you really want, I'd probably create two (temporary?) indexes:

1) STR(MONTH(bday),2)+STR(DAY(bday),2) && ignores Year MMDD
2) DTOS(bday) && assuming 2nd example is YYYYMMDD ordered

and set the order to the index that I want the report to use.

Rick

Note: A variant on 1) that also sorts the years descending for the same month day, would be:
3) STR(MONTH(bday),2)+STR(DAY(bday),2)+STR((9999-YEAR(bday)),2)
 
Hello.

SELECT * FROM table_with_dates INTO CURSOR crDates ORDER BY DAY(birthday),YEAR(birthday)

Hope this helps.

Grigore Dolghin
 
Hello again (two minutes later :)

Or, maybe, you'll like the following:

SELECT table_with_dates
INDEX ON STR(DAY(birthdate)) + STR(YEAR(birthdate)) TAG order


If I understood correctly, you want birthdates to be sorted by day and year, disregarding month. Both ways work.

Hope this helps.

Grigore Dolghin
 
Thanks to all of you:). I think this would work now. By the way what I am going to sort is the day only since I have already filtered it by month.

Wendz
edbb@lycos.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top