表a:aa bbwd 温度……表b:cc    ddwd90  很高wd50  不高
……表c:no zt tj jg1  wd 0  wd902  wd 1  wd50……(上面那个tj为0代表等于 tj为1代表不等于)得到新表:no 结论1  温度等于很高
2  温度不等于不高

解决方案 »

  1.   

    select c.no,
           (select a.bb from a where zt = a.aa),
           case when tj = 0 then '等于' else '不等于' end,
           (select b.dd from b where jg = b.cc)
    from c
      

  2.   

    select no,bb+case tj when 0 then '等于' when 1 then '不等于' else '' end+dd 
    from a,b,c
    where a.aa=c.zt and b.cc=c.jg
      

  3.   

    select c.no,
           结论=a.bb+case when tj = 0 then '等于' else '不等于' end + b.dd
    from tablec c
    left join tablea a on a.aa = c.zt
    left join tableb b on b.cc = c.tj