union query syntax

G

Guest

Thanks for the help. I'm using Office 2003. I just created 4 queries to find
the most recent payment on 4 different credit cards. Now I want to create a
union query to compile the data into one location.

Problem: When I copy the SQL syntax from each of the queries I get this
error message:

The ORDER BY expression ([name of table].name of field) includes fields that
are not selected by the query. Only those fields requested in the first query
can be included in an ORDER BY expression.

So when I take out either or both of the order by expressions I get the
wrong answers from the original queries. : (

What do I need to fix? Please be specific with the answer, I'm a real
beginner with SQL code. THANKS !
 
J

Jeff Boyce

We can't see your SQL code, so it could be tough to diagnose...

We can't see your data structure, so it could be tough to diagnose...

It almost sounds like you have each credit card info in a separate field (a
very good design, if you are working in a spreadsheet, but counterproductive
for a relational database).

More info, please...

Jeff Boyce
<Access MVP>
 
M

Michel Walsh

Hi,


Have just one ORDER BY clause in the whole UNION query, at the end, and use
the field names you use for the first SELECT in that query.


Hoping it may help,
Vanderghast, Access MVP
 

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

Similar Threads


Top