|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I'm having 'one of those days'
and have hit a brick wall that I currently can't get round/over/through.I want to run a query that selects various fields from an address table. I want to order the data by the first 3 chars of the postcode field as to order by the whole postcode field is too specific for my needs and throws the rest of my data out in a way I do not want it. Is there anyway to modify the 'order by postcode' bit of my statement to reflect the fact I only actually want it ordered by the 'AA1' bit and not the whole 'AA11AA'. Hope this makes sense - kinda got myself confused now Many thanks |
|
#2
|
|||
|
|||
|
Code:
order by substring(postcode,1,3) |
|
#3
|
|||
|
|||
|
Many thanks
Took a break, thought about it for a bit and discovered LEFT which worked too. But substring is much better as I can use this for all my weird string needs and hopefully as I'll use it lots now I know it I'll remember it. Thanks again ![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Order by part of a field |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|