我需要从子查询中指定的列返回信息。在下面的子查询中,我试图从 PaymentDate 列返回信息。当我尝试在查询中选择 Order.PaymentDate 时,我收到一个错误Invalid object name
。Order.PaymentDate
我试图将其指定为 Payment.PaymentDate 但我得到了同样的错误。关于如何解决这个问题的任何想法?
(SELECT ID, SUM(amount) AS purchase FROM Order
WHERE Order.PaymentDate BETWEEN '2012-09-01' AND '2012-09-04'
AND Order.amount >=0
GROUP BY ID)Payment