|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ORDER BY a value in a string
I'm having a little trouble with sql order by. I have a a column that has values of:
Gillite.Qutz Tom.Goo Jill.Hank Joseph.Cool I want to be order by their last name, which is after the period: Joseph.Cool Tom.Goo Jill.Hank Gillite.Qutz How would I go about doing that? Thanks! Sunny B. |
|
#2
|
|||
|
|||
|
Try this:
SELECT TheName FROM tblDeleteMe ORDER BY SUBSTRING(TheName, CHARINDEX('.', TheName) + 1, LEN(TheName) - CHARINDEX('.', TheName)) |
|
#3
|
|||
|
|||
|
Thank you! That worked great!
![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > ORDER BY a value in a string |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|