I want to implement the statement that when b.phase>2, execute the splicing condition: AND unix_timestamp()> second_end_time
Otherwise, the splicing condition: AND unix_timestamp()> thirdly_end_time
Can you please tell me how to write this 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
The above is written randomly by myself, the grammar is not correct, please give me some advice!