想实现当b.phase>2就执行拼接条件:AND unix_timestamp()> second_end_time
否则拼接条件:AND unix_timestamp()> thirdly_end_time 的语句
求教各位应如何编写该SQL?
SELECT * FROM data a, race b
WHERE
a.race_id = b.race_id
IF (b.phase > 2, AND unix_timestamp()> second_end_time , AND unix_timestamp()> thirdly_end_time)
AND user_id = 123
以上为自己乱写,语法并不对,求指点!
雷雷