JOIN 在ACESS与SQL的不同写法

多个left join 不在access 和sql的写法是不同的 如

ACCESS

select g.ccbh,g.jyrq,g.[10IB老化后],g.[033IB老化后],g.[05LIB老化后],h.[05L02IB老化后] from (select e.ccbh,e.jyrq,e.[10IB老化后],e.[033IB老化后],f.[05LIB老化后]  from  
(  select d.ccbh,d.jyrq,d.[10IB老化后],b.[033IB老化后] from 
              ( 
                                      SELECT a.ccbh,a.JYRQ,c.WCPJ as [10IB老化后] FROM DBCS a  
                                      left join (
                                                   select WCPJ,jh,jyrq from jbwc where glys ='1.0' and IB='IB'
                                                 ) c  on a.ccbh=c.jh and format( a.jyrq,'yyyy-mm-dd')=format( c.jyrq,'yyyy-mm-dd')
                                                 ) d 
                                      left join (
                                                   select WCPJ as [033IB老化后],jh,jyrq from jbwc where glys ='1.0' and IB='0.033Ib'
                                                 ) b on d.ccbh=b.jh and d.jyrq=b.jyrq
                                                 ) e
                                      left join (
                                                   select WCPJ as [05LIB老化后],jh,jyrq from jbwc where glys ='0.5L' and IB='IB'
                                                 ) f on e.ccbh=f.jh and e.jyrq=f.jyrq
                                                ) g
                                      left join (
                                                   select WCPJ as [05L02IB老化后],jh,jyrq from jbwc where glys ='0.5L' and IB='IB'
                                                ) h
                                    on g.ccbh=h.jh and g.jyrq=h.jyrq


SQL

SELECT a.ccbh,a.JYRQ,b.033IB老化后,f.05LIB老化后,h.05L02IB老化后,c.WCPJ as 10IB老化后 FROM DBCS a  
             left join (
                         select WCPJ,jh,jyrq from jbwc where glys ='1.0' and IB='IB'
                        ) c  on a.ccbh=c.jh and format(a.jyrq,'yyyy-mm-dd')=format(c.jyrq,'yyyy-mm-dd')
             left join (
                           select WCPJ as 033IB老化后,jh,jyrq from jbwc where glys ='1.0' and IB='0.033Ib'
                        ) b on a.ccbh=b.jh and a.jyrq=b.jyrq
             left join (
                          select WCPJ as 05LIB老化后,jh,jyrq from jbwc where glys ='0.5L' and IB='IB'
                       ) f on a.ccbh=f.jh and a.jyrq=f.jyrq
             left join (
                           select WCPJ as 05L02IB老化后,jh,jyrq from jbwc where glys ='0.5L' and IB='IB'
                       ) h on a.ccbh=h.jh and a.jyrq=h.jyrq 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值