From: "redhat" <[EMAIL PROTECTED]>

> I have a page that I put together that pulls in data for the time in
> individual fields - hour, minute, am/pm, month, day.  I am going to
> alter the db to add year as well.  I want to order this list by multiple
> criteria - first by year, then by hour, am/pm, minute.  It is a page
> that lists shows that are running on a local cable channel.  Is there a
> way to do what I am asking?  I know that I can 'select * from table
> order by year asc' but don't know how to sub order the items.
> thanks,

Answer you're looking for:
SELECT * FROM Table ORDER BY year ASC, month ASC, day ASC

Correct answer:

Use a DATETIME or TIMESTAMP field for your dates instead of separate columns
for each part. When you start looking for things that span certain lengths
of time, you'll thank yourself. You can still pull each part out if need be.
You'll also only need to sort based upon the single column.

---John Holmes...

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to