MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 11th, 2004, 12:03 AM
uno_turko uno_turko is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 131 uno_turko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 32 m 23 sec
Reputation Power: 5
MS Sql Statements

SELECT SLSEML, SLSFON, SLSLVL, SLSMOB, SLSNAM, SLSSUR, SLSPIC
FROM dbo.salesperson
WHERE AGT_ID = 559000 and SLSSAT = 'A'
ORDER BY SLSLVL ASC

In the above statement, i have ordered by, but in that order by statement is there a way i can order by values in that row...i.e. ORDER BY SLSLVL (then type in the order i want them displayed in, e.g. principal then salesperson, then administration....i want principal first then sales, then admin)

I hope i have given enough information without confusion the situation too much.

Thanks
uno_turko

Reply With Quote
  #2  
Old June 11th, 2004, 02:50 AM
swampBoogie swampBoogie is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jan 2003
Location: Paris Uppland
Posts: 1,784 swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level)swampBoogie User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 21 h 42 m 49 sec
Reputation Power: 37
Code:
order by case slslvl
when 'Principal' then 1
when 'Salesperson' then 2
when 'Administration' then 3 else 4 end

Reply With Quote
  #3  
Old June 14th, 2004, 06:48 PM
uno_turko uno_turko is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 131 uno_turko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 32 m 23 sec
Reputation Power: 5
SELECT SLSEML, SLSFON, SLSLVL, SLSMOB, SLSNAM, SLSSUR, SLSPIC
FROM dbo.salesperson
WHERE AGT_ID = 559000 and SLSSAT = 'A'
ORDER BY CASE SLSLVL
WHERE 'PRINCIPAL' THEN 1
WHERE 'SALESPERSON' THEN 2
WHERE 'ADMIN' THEN 3 ELSE 4 END

HI, THANKS FOR YOUR REPLY, THE DEVSHED IS GREAT I JUST SUBSCRIBED LAST WEEK AND I GET THE DRIFT I WILL BE GETTING LOTS OF HELP HERE.

I TYPED IN THE FOLLOWING QUERY AND I GOT A SYNTAX ERROR
P.S. ALL THE SPELLING IS CORRECT.
IS THERE ANYTHING ELSE I HAVE TO DO

UNO_TURKO

Reply With Quote
  #4  
Old June 14th, 2004, 06:55 PM
uno_turko uno_turko is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 131 uno_turko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 32 m 23 sec
Reputation Power: 5
Hi there,

SOOO SORRY my mistake, i am typing "where", it should of been "when"
Chat soon

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > MS Sql Statements


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT