簡體   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