I have the following tables which look like this:
table tartist +----+------+------+-------+-------+ | id | name | info | image | genre | +----+------+------+-------+-------+
table programm +----+------+-------+--------+ | id | date | stage | artist | +----+------+-------+--------+
I want to be able to sort by stage and genre. Stage is no problem, since it's kept in the programm table. Sorting by genre I believe could work with a JOIN, but I have tried and didn't quite understand what and where to join things here.
The idea is: SELECT id, date, stage, artist FROM programm WHERE tartist.id=artist AND tartist.genre=$genre;
In words: Select every row from programm where artist matches the id in tartist and where genre in tartist is of value $genre.
It seems the SQL isn't quite right here. Try something like:
select p.id, p.date, p.stage, p.artist from programm p, tartist t where p.artist = t.id and t.genre=$genre;
Mike -- Mike Kruckenberg [EMAIL PROTECTED] http://mike.kruckenberg.com
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]