?
Solved

Query details from query results?

Posted on 2011-02-10
4
Medium Priority
?
296 Views
Last Modified: 2012-05-11
I need to get some result details based on a seperate query result.

I have two tables, Order and OrderDetails.

I need to pick out all the orders in Orders that were ordered by the same Cust# on the same OrderDate. Sum  (Orders > 1) .

Using those specific order numbers I need to pull out the orderdetails description.

I know this is a little vague but I think it describes the basic need. The results of one query will determine what is pulled by the second query.

Thanks
0
Comment
Question by:LanBuddha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34866974
post sample data or better upload a copy of the db..
0
 
LVL 2

Author Comment

by:LanBuddha
ID: 34867064

Order#     OrderDate#      Cust#
123           1/1/2011          1
124           1/1/2011          1
125           1/2/2011          3
126           1/3/2011          4

I should pull back order 123 and 124 because they were placed on same day by same customer.

OrderDetails
Order#      Desc
123          Product1
123          Product2
124          Product3
125          Product1

I need the details of order# 123 and 124 based on previous table.

Thanks
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 34867149
test this query


SELECT Order.OrderDate, Order.CustNo, Order.OrderNo,OrderDetails.Desc
FROM [Order] Inner Join [OrderDetails]
ON [Order].OrderNo=[OrderDetails].OrderNo
WHERE (((Order.OrderDate) In (SELECT [OrderDate] FROM [Order] As Tmp GROUP BY [OrderDate],[CustNo] HAVING Count(*)>1  And [CustNo] = [Order].[CustNo])))
ORDER BY Order.OrderDate, Order.CustNo;
0
 
LVL 2

Author Closing Comment

by:LanBuddha
ID: 34867701
Great. Got me where I need to be. Nice, quick response.
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question