如何比较where子句中的datetime值?

时间:2015-02-03 22:10:53

标签: sql-server

我有三张相互连接的桌子  第一表是第二类是产品,第三类是交易 当我尝试从前两个表中获取数据时,其工作正常

SELECT     ProductCategory.CategoryName, SUM(ProductSell.Quantity) AS tq, SUM(ProductSell.Price) AS tp
FROM         ProductCategory INNER JOIN
                      ProductSell ON ProductCategory.CategoryID = ProductSell.CategoryID
GROUP BY ProductCategory.CategoryName

至于我使用第三个表来获取日期特定数据的条件,那时候它没有给出任何输出

SELECT     ProductCategory.CategoryName, SUM(ProductSell.Quantity) AS tq, SUM(ProductSell.Price) AS tp
FROM         ProductCategory INNER JOIN
                      ProductSell ON ProductCategory.CategoryID = ProductSell.CategoryID INNER JOIN
                      Transactions ON ProductSell.TransactionID = Transactions.TransactionID
Where Transactions.Date1>='11/1/2014' and Transactions.Date<='2/3/2015'
GROUP BY ProductCategory.CategoryName

由于

0 个答案:

没有答案