Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help sorting results of union 2

Status
Not open for further replies.

bbwrede

Programmer
May 22, 2003
52
US
Hi, I am working in 8.5 and have been able to sucessfully union to selects with subqueries together. I get the correct records, but I can't figure out how to sort them. Any time I add the order by clause it causes an error. I have tried adding it to either select. Thanks for any help.
 
Use the column number, not the column name,
in the ORDER BY statement (and of course ORDER BY
only in the last SELECT statement).

For example,
-----------------
SELECT...

UNION

SELECT...
ORDER BY 2
-----------------

Cheers,
- Ido


CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Nice one Ido, good tip.

Gary Parker
Systems Support Analyst
Manchester, England
 
Thanks you so much. I don't think I would have every thought of that!
Barb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top