Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

sorting twice on same field

sorting twice on same field

6:32 pm on Jan 7, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:May 1, 2004
posts: 104
votes: 0

Can some expert help save the sanity of this sad newbie before I go totally insane trying to figure it out.

I have a large table containing reservations. Reservation can have multiple 'lines', each with a different date. I want to produce reports listing all reservations in date order, but with ALL lines for each reservation then listed sequentially in the same group.

For example, the table contains:

ResNo Date
45678 2009-02-03
12345 2009-02-02
23456 2009-01-01
12345 2009-02-06

And I want a report listed like:

2009-01-01 23456
2009-02-02 12345 *
2009-02-06 12345 *
2009-02-03 45678

My question is how would I achieve this with a SELECT statement? I assume it would require a sub-query, but this is outside my experience and a few pointers would be appreciated.

Thanks in anticipation of any help.