繁体   English   中英

如何在Access 2007中编写此查询

[英]how to write this query in access 2007

select ((select SUM (Total) 
           from Shirt_Mes 
           where CustomerId =2 
           and Created_Date ='2016-10-05 05:25:06.000')
      + (select SUM (Total)
           from Pant_Mes 
            where CustomerId =2 
            and Created_Date ='2016-10-05 05:25:06.000' )

MS Access需要带有表的FROM子句。 因此,我们都将其移至FROM子句。 还有其他一些更改:

select s.sums + p.sump
from (select SUM(Total) as sums
      from Shirt_Mes 
      where CustomerId = 2 and
            Created_Date = #10/5/2016#  -- different date format
     ) as s,  -- Oh, it hurts that MS Access does not have `cross join`
     (select SUM(Total) as sump
      from Pant_Mes 
      where CustomerId = 2 and
            Created_Date = #10/5/2016#
     ) as p;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM