求助一下set @openid1 =(select openid from table1 where tel='13812345678');
select @openid1;IF (@openid1 is null) OR (@openid1='') THEN
 set @openid1 =(select openid from table2 where tel='13812345678');
END IF
select @openid1;
上面的代码会提示错误在 
IF (@openid1 is null) OR (@openid1='') THEN
 set @openid1 =(select openid from table2 where tel='13812345678');
END IF
select @openid1;
这一段中,改了好久没改对

解决方案 »

  1.   

    通过用户的手机号码,获取他的openid,先从table1读取,如果table1没有,则读取table2,  逻辑上很简单,但是语法上,不知道为什么一直报错
      

  2.   


    SET @openid1 =(select openid from table1 where tel='13812345678');
    SELECT @openid1;IF (@openid1 is null) OR (@openid1='') THEN
         set @openid1 =(select openid from table2 where tel='13812345678');
    END IF;
    select @openid1;
      

  3.   

    END IF; 
    END IF 这里要以分号结尾
      

  4.   

    手机回帖,猜测应该这样。if (o1 is null or o1=‘’) then...