Usage of MySQL's “IF EXISTS”

前端 未结 5 1911
Happy的楠姐
Happy的楠姐 2020-11-22 13:25

Here are two statements that I\'d like to work, but which return error messages:

IF EXISTS (SELECT * FROM gdata_calendars WHERE `group` =  ? AND id = ?) SELE         


        
5条回答
  •  逝去的感伤
    2020-11-22 13:47

    SELECT IF((
         SELECT count(*) FROM gdata_calendars 
         WHERE `group` =  ? AND id = ?)
    ,1,0);
    

    For Detail explanation you can visit here

提交回复
热议问题