MYSQL if a select query returns 0 rows then another select query?

前端 未结 7 1141
故里飘歌
故里飘歌 2020-12-03 18:01

if select * from table where x=1 returns 0 rows, then I need select * from table where x=2 [or some other query]. Is it possible to do this in a si

相关标签:
7条回答
  • 2020-12-03 18:36

    you can use EXIST and NOT EXIST statement to check that result is null or not. if result is Null then you can get value from table2.

    0 讨论(0)
提交回复
热议问题