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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -