Inner Join with queries

R

Rafa

Hi i need to do an inner join with two agregate queries. I know I can save a
view and do it in the graphic editor, but i want to avoid creating so many
views, so i'm trying to write the code for every subquerie inside the big
querie and i keep getting error messages.
 
T

Tom van Stiphout

On Thu, 12 Nov 2009 09:22:02 -0800, Rafa

Since you did not share your code, stripped to the bare essentials,
that leaves me free to speculate. For example this may work:
--Find all orders with OrderAmount not equal to sum of lineitems
select O1.* from Orders O1 where O1.OrderAmount <>
(select Sum( OrderDetailAmount) from OrderDetails where OrderID =
O1.OrderID)

-Tom.
Microsoft Access MVP
 
S

Sylvain Lafontaine

One the primary cause of error with using subqueries is missing to provide
an alias name to each of the subquery; even when you don't have to use it.
However, without seeing any of your attempts, it's hard to give you any
advice. Also, this newsgroup is about ADP and SQL-Server and has nothing to
do with Access/JET. I could give you some examples that will work correctly
on SQL-Server but won't under Access/JET; so if you want a better help, you
should post in a newsgroup more appropriate than this one.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top