I want to join candidate table with symbols table if status of candidate is 'independent' and with party table if status of candidate is'party'
Is there any way in sql to execute a query like this or if you can suggest any other solution.
Example:
Select * from candidate c
if c.status='party'
JOIN party p on p.party_id = c.party_id
else if c.status='independent'
JOIN symbol s on s.symbol_id = c.symbol_id
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire