表 testdate 中字段 dateday 為連續的日期
  表 manufacture   中 為統計表  finishday為其日期字段
兩表聯接我已經實現....select     Dateday,                      
          sum(case when (ProjectName='FG') and(realTime is not null) then realTime else 0 end) as FGreal,
          convert(decimal(10,1), cast(sum(case when (ProjectName='FG') and(realTime is not null) then realTime else 0 end)  as real)/100*100) as FGper
    
FROM             { oj   testday  left  OUTER JOIN
                          Manufacture  ON    convert(char(10),convert(smalldatetime,finishday),111) =convert(char(10),convert(smalldatetime,dateday),111) }
group by dateday
order by dateday結果   顯示如下:        dateday      FGreal      FGper 
                       2004/10/10        50        0.5
                       2004/10/11        60        0.6
                       2004/10/12        70        0.7
              問題又出了一個表electrod  yupaidate 為其日期字段
現在實現的問題就是三個表外聯接實現  顯示如下:        dateday      FGreal      FGper     第三個表real   第三個表Per
                       2004/10/10        50        0.5          80          0.8
                       2004/10/11        60        0.6          90          0.9
                       2004/10/12        70        0.7          100           1等待你們的幫組!
 
                 

解决方案 »

  1.   

    dateday      FGreal      FGper     第三個表real   第三個表Per
    2004/10/10      50        0.5          80          0.8
    2004/10/11      60        0.6          90          0.9
    2004/10/12      70        0.7          100           1三個表聯接條件是  testday.dateday=electrod.yupaidate=Manufacture.finishday
      

  2.   

    两个表的联接都实现了,三表也一样啦。。
    (两个表JOIN的语句)AS T1, 这样就变成T1表与第三个表的联接问题了。。
      

  3.   

    table1  left  OUTER JOIN table2 on (...)left join table3 on (...)楼主怎么会问这么弱智的问题?
      

  4.   

    http://community.csdn.net/Expert/TopicView2.asp?id=3686667&datebasetype
    lk
      

  5.   

    欢迎加入Borland 一线程序员,参与群里技术讨论!欢迎女孩子,也欢迎男孩子参与技术讨论!群号15154361