Select * From 
    (select * from Uto_prdspec Where ditype='4743' and charindex(',1',dicode)>0) a,
    (select * from Uto_prdspec Where ditype='4746' and charindex(',2',dicode)>0) b,
    (select * from Uto_prdspec Where ditype='4752' and charindex(',1',dicode)>0) c 
Where a.prdid=b.prdid and a.prdid=c.prdid
服务器: 消息 170,级别 15,状态 1,行 13
第 13 行: ',' 附近有语法错误。
服务器: 消息 170,级别 15,状态 1,行 14
第 14 行: 'b' 附近有语法错误。
服务器: 消息 170,级别 15,状态 1,行 15
第 15 行: 'c' 附近有语法错误。

解决方案 »

  1.   

    原型是这样的select * from [Uto_prdspec] a,[Uto_prdspec] b ,[Uto_prdspec] c 
    where a.prdid=b.prdid and a.prdID=c.prdid
    and a.ditype='4743' and charindex(',1',a.dicode)>0 
    and b.ditype='4746' and charindex(',2',b.dicode)>0 
    and c.ditype='4752' and charindex(',1',c.dicode)>0
    我想优化下性能!
      

  2.   


    Select * From  
    (
      select * from Uto_prdspec Where ditype='4743' and charindex(',1',dicode,1)>0
    union all
      select * from Uto_prdspec Where ditype='4746' and charindex(',2',dicode,1)>0
    union all
      select * from Uto_prdspec Where ditype='4752' and charindex(',1',dicode,1)>0) as a
    Where a.prdid=b.prdid and a.prdid=c.prdid
      

  3.   


    Select * From  
      (select * from Uto_prdspec Where ditype='4743' and charindex(',1',dicode)>0) a,--这逗号不是英文字符的
      (select * from Uto_prdspec Where ditype='4746' and charindex(',2',dicode)>0) b,--这逗号不是英文字符的
      (select * from Uto_prdspec Where ditype='4752' and charindex(',1',dicode)>0) c  
    Where a.prdid=b.prdid and a.prdid=c.prdid
    --LZ看看
      

  4.   


    不好意思,后面的Where写错了。
      

  5.   

    应该是下面这样吧!Select * From  
      (select * from Uto_prdspec Where ditype='4743' and charindex(',1',dicode)>0) as a,
      (select * from Uto_prdspec Where ditype='4746' and charindex(',2',dicode)>0) as b,
      (select * from Uto_prdspec Where ditype='4752' and charindex(',1',dicode)>0) as c  
    Where a.prdid=b.prdid and a.prdid=c.prdid
      

  6.   

    你要保证(select * from Uto_prdspec Where ditype='4743' and charindex(',1',dicode)>0)是唯一行的呀