467,917 Members | 1,401 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,917 developers. It's quick & easy.

I need 'order' in a select w/ Union statement

I've got a statement as follows that grabs matching records out two tables:

"SELECT * FROM BKRETAIL WHERE BKRETAIL.MATK='THISTHE' UNION SELECT * FROM BKMASTER WHERE BKMASTER.MATK='THISTHE';

My problem is that when I try to place something like "ORDER BY BKRETAIL.MEDSTA ASC" after the statement, it throws an error. I need these ordered in a certain arrangement. To be honest, what I really need is to order them by when MEDSTA's field is "RT" first, then "LW", then "OE", then null... but I haven't been able to figure out how to do that so I just put in an "ORDER BY" so the nulls would at least be at the end... Can anybody help me figure out how to order this list?? Thanks BUNDLES
Sep 11 '08 #1
  • viewed: 1281
Share:
1 Reply
ck9663
Expert 2GB
In UNION, ORDER BY will be executed on the final resultset.

Try removing the qualifying name. Just the columnname.

ORDER BY MEDSTA ASC

-- CK
Sep 11 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by News | last post: by
3 posts views Thread by Mike Blanchard | last post: by
4 posts views Thread by rdemyan via AccessMonster.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.