想實作當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(timestamp()> second_end_time , AND unix_timestamp()> thirdly_end_time)
AND user_id = 123
以上為自己亂寫,語法並不對,求指點!
雷雷