'order by' in an sql

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I finally wrote union statement in an sql that didn't give me an error
message. However, I wanted to sort by the second field I listed. I used the
line ORDER BY [last name] The query is still sorting by first name. I am
working in XP office professional.
 
[last name] must be in the Field list of the first part (left part) of the
Union.

If [last name] is already in the first part, post your SQL String.
 
Lee said:
I finally wrote union statement in an sql that didn't give me an error
message. However, I wanted to sort by the second field I listed. I used the
line ORDER BY [last name] The query is still sorting by first name.

Try using its ordinal position in the SELECT clause e.g.

ORDER BY 2;

Jamie.

--
 

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

Back
Top