|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
Code:
order by case slslvl when 'Principal' then 1 when 'Salesperson' then 2 when 'Administration' then 3 else 4 end |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
Hi there,
SOOO SORRY my mistake, i am typing "where", it should of been "when" Chat soon |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > MS Sql Statements |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|