If in mysql

I need a simple if example in mysql. I do not want to consider another case only if the sentence

+3
source share
1 answer

Example:

SELECT *,
       if (`date_last` IS NULL,prev_date,last_date) as date 
FROM `table_name` 
WHERE `id` = 2 
ORDER BY `date` DESC
+3
source

Source: https://habr.com/ru/post/1754190/


All Articles