标签: sql mysql
我想要一个mysql中if子句的简单示例。我不想考虑其他情况,只有条款
答案 0 :(得分:3)
例如:
SELECT *, if (`date_last` IS NULL,prev_date,last_date) as date FROM `table_name` WHERE `id` = 2 ORDER BY `date` DESC