If we want to use “if then” conditions in our code, in some cases, it can be done in mysql queries itself. For eg .
SELECT IFNULL(a,b) ) as val
In the above statement, the value of val will be equal to “a” if “a” is not null or it will be “b” if “a” is null.
another peculiar eg is “(SELECT IFNULL(special_price,p.price) ) as current_price” where the value of special_price is coming from another query in the same sql string (multiple queries).
