IF(condition, result1, result2) : IF « Function « SQL / MySQL






IF(condition, result1, result2)

      

--you can also nest IF queries:

IF(condition1, result1, IF(condition2, result2a, result2b)

   
    
    
    
    
    
  








Related examples in the same category

1.The IF() function compares three expressions, as shown in the following syntax:
2.Use an IF function to evaluate which designs sell over 500 units during the winter sales quarter
3.SELECT IF('02-29' < '03-01','02-29','03-01') AS earliest;
4.Mapping NULL Values to Other Values for Display
5.display GB value with IF() that maps 0 to a dash