Now I wan't to get all the rows from events (id, event, date) in cronological order by date. But I also wan't a random row (id, , ext, *_nail) from the gallery where gallery.event is equal to event.id.
In pratical speech; I wan't to list the events and show a random image from that category.
I currently use the following query which only work halfway
SELECT events.id, gallery.id AS image, events.event, DATE_FORMAT(date, '%d.%m.%Y') AS date FROM events LEFT JOIN gallery ON event.id = gallery.event ORDER BY date DESC
CREATE TABLE `events` ( `id` int(3) unsigned NOT NULL auto_increment, `event` varchar(255) NOT NULL default '', `date` timestamp(8) NOT NULL, `unique` varchar(32) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `unik` (`unique`) ) TYPE=MyISAM;
CREATE TABLE `gallery` ( `id` int(3) unsigned NOT NULL auto_increment, `ext` varchar(4) NOT NULL default '', `description` varchar(255) NOT NULL default '', `event` int(3) unsigned NOT NULL default '0', `width` int(4) NOT NULL default '0', `height` int(4) NOT NULL default '0', `width_nail` int(4) NOT NULL default '0', `height_nail` int(4) NOT NULL default '0', `unique` varchar(32) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `unik` (`unique`) ) TYPE=MyISAM;
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]