mysql - Using an if else if after a where in an sql statement -
how can use if, else if in sql statement after where?
i'm trying achieve using php , mysql:
//pseudocode $i = 3 select count(id) products parent = $foo , type = (if $i = 2 type = 1, else if = 3 type = 2 or 1, else if = 10 type = 3)
how can this?
use case statement or that
where ordernumber case when isnumeric(@ordernumber) = 1 @ordernumber else '%' + @ordernumber end
or can use if statement @n. j. reed
Comments
Post a Comment