sort by date

From: Date: Wed, 06 Nov 2002 14:55:13 +0000
Subject: sort by date
Groups: php.db 
Request: Send a blank email to php-db+get-23013@lists.php.net to get a copy of this message
I have two tables, one contains event information and the other dates that the event takes place:
| id            | int(11)      |      | PRI | 0       | auto_increment |
| title         | varchar(100) | YES  |     | NULL    |                |
| location      | varchar(100) | YES  |     | NULL    |                |
| address       | varchar(100) | YES  |     | NULL    |                |
| contact       | varchar(100) | YES  |     | NULL    |                |
| category      | varchar(100) | YES  |     | NULL    |                |
| event_time    | varchar(200) | YES  |     | NULL    |                |
| urllink       | varchar(100) | YES  |     | NULL    |                |
| descript      | text         | YES  |     | NULL    |                |
| id         | int(11) |      | PRI | 0       | auto_increment |
| event_key  | int(11) | YES  |     | NULL    |                |
| event_date | date    | YES  |     | NULL    |                |
They are linked via dateTable.event_key=eventTable.id I want to be able to sort by the first date that the event takes place. I tried: $sql="select e.*,d.event_date from eventTable e,dateTable d where e.id=d.event_key order by d.event_date,d.event_key but it still shows each date that the event takes place. I tried doing a min(d.event_date) as event_date and then "group by" instead of "order by" but still get too many results. Any help to straighten this out? Terry

« previous php.db (#23013) next »