union query syntax

  • Thread starter Thread starter Guest
  • Start date Start date
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 !
 
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>
 
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
 
Back
Top