Solved

how do I sort this criteria in sql server?

Posted on 2008-06-10
2
559 Views
Last Modified: 2008-06-10
i want to order by name as well as status in my order the status = A , T, C .. since the status is oder by it gives me the results as A, C, T ... my sql is,
SELECT A.EE_NAME,A.EE_STATUS
		 FROM EMPLOYEE_PERSONAL  A
		 INNER JOIN COMPANY_LIST B ON  A.BROKERID = B.BROKERID AND A.CLIENTID = B.CLIENTID
		 WHERE  A.BROKERID =1 AND B.BROKERID = 1 AND A.CLIENTID = 1
		 AND B.CLIENTID = 2
		 ORDER BY A.EE_STATUS, A.EE_NAME;

Open in new window

0
Comment
Question by:Loganathan Natarajan
[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
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 21750019
change
ORDER BY A.EE_STATUS

into

ORDER BY CASE A.EE_STATUS WHEN 'A' THEN 1 WHEN 'T' THEN 2 WHEN 'C' THEN 3 ELSE 99 END
0
 
LVL 36

Author Comment

by:Loganathan Natarajan
ID: 21750059
perfect .. it works... many thanks ..,
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

732 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