Solved

Error with Order by

Posted on 2011-02-10
3
256 Views
Last Modified: 2012-05-11
select Distinct -1 as InvestigatorID, Ltrim(Rtrim(p.Name)) as InvestigatorName
Order by p.Name
I get the following error.  How can I fix this?  Thank you.
ORDER BY items must appear in the select list if the statement contains a UNION, INTERSECT or EXCEPT operator.
0
Comment
Question by:lapucca
3 Comments
 
LVL 8

Accepted Solution

by:
pdd1lan earned 500 total points
ID: 34864088
select Distinct -1 as InvestigatorID, Ltrim(Rtrim(p.Name)) as InvestigatorName
Order by  InvestigatorName
0
 

Author Closing Comment

by:lapucca
ID: 34864130
Ah, great.  Thanks.
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 34864145
Order by 2

2 represents the second column...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now