我的sql语句:
select dstime,lanmu,advid,placeid,photo,linkurl,concat('a',groupid,id) as newid from view_adv where placeid like '%+newid+%'
我的问题是,我where后面条件需要用到前面组合字段newid,请问对于这种该怎么处理

解决方案 »

  1.   

    select dstime,lanmu,advid,placeid,photo,linkurl,concat('a',groupid,id) as newid from view_adv where placeid like 
    concat('%a',groupid,id,'%')
      

  2.   

    select *from (select dstime,lanmu,advid,placeid,photo,linkurl,concat('a',groupid,id) as newid from view_adv where placeid like '%+newid+%')
    where newid xxxx
      

  3.   

    select dstime,lanmu,advid,placeid,photo,linkurl,concat('a',groupid,id) as newid 
    from view_adv 
    where placeid like concat('%','a',groupid,id,'%')