HardWorking
New member
- Local time
- Today, 00:16
- Joined
- Apr 13, 2020
- Messages
- 8
I am using a recreated query from the Northwind DB which is similar to the query that I need an answer on.
I am trying to run a Group By SubQuery and use it's results for the outer query.
My goal is to have the records form my inner query control the total number of records from my outer query.
From Northwind DB
Orders Table has 830 records
My inner query shows 89 records if run by itself.
When I combine my 2 queries I get results showing 159 records
How do I get the inner query to control the number of records for my outer query?
Also, in my actual query I get "Invalid argument to function" with no results, but when I recreate this query using the Northwind
DB I do not get the error, but the total records do not match my records from the inner query.
Here is my query:
SELECT *
FROM Orders
WHERE (((Orders.OrderDate) In
(SELECT Max(Orders.OrderDate)
FROM Orders
GROUP BY [Orders].[CustomerID]
)));
I am trying to run a Group By SubQuery and use it's results for the outer query.
My goal is to have the records form my inner query control the total number of records from my outer query.
From Northwind DB
Orders Table has 830 records
My inner query shows 89 records if run by itself.
When I combine my 2 queries I get results showing 159 records
How do I get the inner query to control the number of records for my outer query?
Also, in my actual query I get "Invalid argument to function" with no results, but when I recreate this query using the Northwind
DB I do not get the error, but the total records do not match my records from the inner query.
Here is my query:
SELECT *
FROM Orders
WHERE (((Orders.OrderDate) In
(SELECT Max(Orders.OrderDate)
FROM Orders
GROUP BY [Orders].[CustomerID]
)));