SELECT IF('02-29' < '03-01','02-29','03-01') AS earliest; : IF « Function « SQL / MySQL






SELECT IF('02-29' < '03-01','02-29','03-01') AS earliest;

      
mysql>
mysql>
mysql> SELECT IF('02-29' < '03-01','02-29','03-01') AS earliest;
+----------+
| earliest |
+----------+
| 02-29    |
+----------+
1 row in set (0.00 sec)

mysql>

   
    
    
    
    
    
  








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.IF(condition, result1, result2)
4.Mapping NULL Values to Other Values for Display
5.display GB value with IF() that maps 0 to a dash