mysql : possible to put IF statment in LEFT JOIN ?

Posted by Haroldo on Stack Overflow See other posts from Stack Overflow or by Haroldo
Published on 2010-05-07T17:22:28Z Indexed on 2010/05/07 17:28 UTC
Read the original article Hit count: 186

Filed under:
|

Ok so i want to get an artists info from the db, but i want to know if they have any forthcoming events. To do this i need to traverse 2 tables, where events_artists is a 2 col link table...

(this doesnt work but is what id like to do)

SELECT art.*, events.event_id FROM art 
LEFT JOIN events_artists
ON art.art_id = events_artists.art_id
LEFT JOIN events
ON events_artists.event_id = events.event_id IF ( {criteria} )  

what should i be doing here to get this to work?!!

© Stack Overflow or respective owner

Related posts about mysql

Related posts about php