Ok, going out on a limb here... have you tried something like

select e.id, title, location, address, contact, category, event_time,
urllink, descript, min(event_date) from eventTable e inner join
dateTable d on e.id = d.id group by e.id

?


Marco

-- 
------------
php|architect - The magazine for PHP Professionals
The first monthly worldwide  magazine dedicated to PHP programmer

Come visit us at http://www.phparch.com!

--- Begin 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


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to