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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
- Re: [PHP-DB] sort by date Terry Romine
- Re: [PHP-DB] sort by date Marco Tabini
- RE: [PHP-DB] sort by date Snijders, Mark
- RE: [PHP-DB] sort by date Snijders, Mark
- RE: [PHP-DB] sort by date Marco Tabini
- Re: [PHP-DB] sort by date Terry Romine
- Re: [PHP-DB] sort by date Ignatius Reilly
- RE: [PHP-DB] sort by date Lisi
- RE: [PHP-DB] sort by date Josh Johnson
- Re: [PHP-DB] sort by date Jeffrey_N_Dyke
- Re: [PHP-DB] sort by date Marco Tabini