Solved

Error with Order by

Posted on 2011-02-10
3
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 56

Expert Comment

by:HainKurt
ID: 34864145
Order by 2

2 represents the second column...
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

630 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