jeudi 10 novembre 2016

Adding condition in where conditionally

I can't seem to find a proper solution for this. Here's the scenario I want to add a condition if the parameter is 0. Looks something like

SELECT * FROM TABLE WHERE  name = @name AND 
//this is the part I dont know but I want something like
IF(@id = 0)
{
//do nothing
}else{
id = @id
}

Aucun commentaire:

Enregistrer un commentaire