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
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 Order by Name MiddleName LastName

Author  Topic 

eeyc
Starting Member

2 Posts

Posted - 2009-09-16 : 05:43:18
Hii
I Have Facing with Order problem
i try to query From Table

it go like this ->

SELECT * FROM Client
WHERE (ClientName LIKE 'X%') OR (ClientName LIKE '%[ ]X%')

it mean give me all clients that start Whit X Letter And Included MiddleName If There is And Last Name.

Name,MiddleName And LastName are At same Cell (ClientName)
i have qury it and sorting it
first by Name after it by MiddleName and finlly by LastName

i don't know how to order it.

Someon Have an idea how to start ?

eyal.c

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-09-16 : 05:58:09
Can you give some sample data?
The start is to split the column in 3 values.
We need samples to see which combination of data can occur in ClientName.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

eeyc
Starting Member

2 Posts

Posted - 2009-09-16 : 07:25:08
thank's for your posting me

i can't split the data
to Name can be have number of names name middlename lastname nikename etc (like the arbs names)
for example -> ClientName
Erorn Mikel Bon Joi
Jack clint cary
Erorn Mikel Bon Jacov
mohamd abo jaml habdalhaa
jaber mahmoud ben saber

now query all j names !

result need to look like this
1. Jack clint cary
2. jaber mahmoud ben saber
3. mohamd abo jaml habdalhaa
4. Erorn Mikel Bon Jacov
5. Erorn Mikel Bon Joi

eyal.c
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-09-16 : 07:50:39
select * from table where ' '+ClientName like '% j%'


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -