T-SQL Subquery Results
Posted on 2012-09-04
I need to return information from a column that is specified in a subquery.
In the subquery below, I am trying to return info from the PaymentDate column.
When I try to Select Order.PaymentDate in my query I get an error Invalid object name for the ORder.PaymentDate. I tried to specify this ias Payment.PaymentDate but I get the aame error.
Any idea on how I can fix this?
(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