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
 General SQL Server Forums
 New to SQL Server Programming
 sort in lexicographic order?

Author  Topic 

ngquochung
Starting Member

13 Posts

Posted - 2006-11-26 : 03:03:10
How to sort elements in column in lexicographic order?
Regards,
H

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-26 : 03:24:12
What do you exactly mean by lexicographic order?
Do you mean case-sensitive order? for that you can use COLLATE clause in ORDER BY.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-11-26 : 23:52:57
quote:
Originally posted by ngquochung

How to sort elements in column in lexicographic order?
Regards,
H


Post some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-11-27 : 10:04:09
quote:
Originally posted by ngquochung

How to sort elements in column in lexicographic order?
Regards,
H



OK, now you are just making stuff up

lexicographic, sheesh

EDIT: Wait...I don't believe this

http://mathworld.wolfram.com/LexicographicOrder.html



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-27 : 10:18:46
[code]SELECT DISTINCT *
FROM (SELECT 1 p UNION ALL SELECT 2 UNION ALL SELECT 3) b0
CROSS JOIN (SELECT 1 p UNION ALL SELECT 2 UNION ALL SELECT 3) b1
CROSS JOIN (SELECT 1 p UNION ALL SELECT 2 UNION ALL SELECT 3) b2
WHERE b0.p <> b1.p
AND b0.p <> b2.p
AND b1.p <> b2.p
ORDER BY b0.p,
b1.p,
b2.p[/code]

Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -