I have an IF statement inside a mySQL query and it is working well:
GROUP_CONCAT(DISTINCT CONCAT("animal:",if(animal.name="monkey","fred",""),",color: ",animal.color) SEPARATOR " <br>") AS animals
I want now add an ELSEIF:
GROUP_CONCAT(DISTINCT CONCAT("animal:",if(animal.name="monkey","fred","")elseif(animal.name="cat","jane",""),",color: ",animal.color) SEPARATOR " <br>") AS animals
But I get an ERROR message:
Syntax error or access violation: 1064 You have an error in your SQL syntax
Aucun commentaire:
Enregistrer un commentaire