|
-
Feb 17th, 2006, 09:54 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Order By clause (TOP clause)
Hi all,
Its me again with yet another question.
I am using SQLServer 2000 and in a view that I am building I have two SELECT statements joined by a UNION. All the info from both statements appears in one column (as it should), but I want the info from the first SELECT to appear on top (its just one line).
I have an ORDER BY clause in my view but when I try to apply it, SQL tells me that I must specify the TOP clause.
I have no idea how to accomplish this task.
Can anyone help???
Last edited by Golfreak; Feb 17th, 2006 at 10:13 AM.
jg
-
Feb 17th, 2006, 10:19 AM
#2
Re: Order By clause (TOP clause)
UNION automatically sorts and distincts the rows in the tables you UNION.
If you want the data to appear in the order of the tables in the UNION you should use UNION ALL.
-
Feb 17th, 2006, 10:24 AM
#3
Thread Starter
Addicted Member
Re: Order By clause (TOP clause)
Thanks kaffenils,
That did the trick!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|