mysql5.0里是不识别exists请问有可以替代的语法吗?盼赐教,谢谢

解决方案 »

  1.   

    可以识别的,估计lz语法错误了
    如下:
    where exists
    (select 1 from
      

  2.   

    谢谢shetianlang的答复但是我在本地(mysql4.1.7)下面的语句运行正常,但往服务器(mysql5.0)传,时提示 exists 有错误.
    select (case when not exists(select 1 from temp where a.shopid=shopid  and productname<a.productname) then shopid
     else ' ' end)AS shopid, 
     shopname,  
     shopadmin,mode,productname,ordertime,state,prodcuts_price,  
     email,dress,tel,(sum(row))as  row from temp a  
     group by shopid,productname,prodcuts_price
      

  3.   

    show:#1064 - You have an error in your SQL syntax near 'exists(select 1 from temp where a.shopid=shopid  and productname<a.productname) ' at line 1 
      

  4.   

    你的group by 错了,应该是这样的:
    group by shopname,shopadmin,mode,productname,ordertime,state,prodcuts_price,email,dress,tel  
      

  5.   

    我按 lllyyymmm(傻貓) 说的试了,不对错误提示还是上面的那个
      

  6.   

    用法如下:
    lz自己参考
    select   A.*   
      from   表1   A   
      where   exists(select   1   from   表2   where   主键=A.主键)