有两个表  
Result表是有 周次  周几  和节次  教室    ------表示已经占用的教室
Lab表中有 教室 和教室容纳量 
我想求  selecet * from where 周次=2 and 周几=2 and 节次=2 的情况下  占用的教室的人数 也就是  周次=2 and 周几=2 and 节次=2的时候 所占教室的总容纳量 不知道有高人明白我的意思么.

解决方案 »

  1.   

    select Sum([教室容纳量]) from [Lab] inner join [Result] on ([周次]=2 and [周几]=2 and [节次]=2 and [Result].[教室] = [Lab].[教室])
      

  2.   

    我想求  selecet * from where 周次=2 and 周几=2 and 节次=2 的情况下  占用的教室的人数
    -------------------------------------------------------------------------------------
    select Sum([教室容纳量]) from [Lab] where 教室 in(select 教室 from Result where 周次=2 and 周几=2 and 节次=2)