Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 Complicated Order By (I think)

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-11 : 08:23:58
Frank writes "I have a field that contains data that looks similar to this in any order:

076
077
091
145
340
034
122
166
021
099

Now how can I say that starting with 076 is a 1 and every number after, that is greater than the previous number, is a 1 and if it's less than it's a 2 and so on and so forth. So I want it like this:

076 1
077 1
091 1
145 1
340 1
034 2
122 2
166 2
021 3
099 3

Now, can this be done without PL/SQL, possibly thru a CASE statement??? Thanks :)"
   

- Advertisement -