Re: Postal code searching

2012-04-25 Thread Hal�sz S�ndor
2012/04/25 10:14 +0100, Mark Goodge On 24/04/2012 17:24, Tompkins Neil wrote: >How about if I want to only return postal codes that are like W1U 8JE >not W13 0SU. > >Because in this example I have W1 as the postal code and W13 is the other >postal code No, you don't. In this example you

Re: Postal code searching

2012-04-25 Thread Tompkins Neil
Thanks for your very detailed response Mark. Most helpful. On Wed, Apr 25, 2012 at 10:14 AM, Mark Goodge wrote: > On 24/04/2012 17:24, Tompkins Neil wrote: > >> How about if I want to only return postal codes that are like W1U 8JE >> not W13 0SU. >> >> Because in this example I have W1 as the

Re: Postal code searching

2012-04-25 Thread Andrew Moore
If nothing else a great intro to the UK postcode. I find this very interesting/useful. Thanks Mark. On Wed, Apr 25, 2012 at 10:14 AM, Mark Goodge wrote: > On 24/04/2012 17:24, Tompkins Neil wrote: > >> How about if I want to only return postal codes that are like W1U 8JE >> not W13 0SU. >> >> B

Re: Postal code searching

2012-04-25 Thread Mark Goodge
On 24/04/2012 17:24, Tompkins Neil wrote: How about if I want to only return postal codes that are like W1U 8JE not W13 0SU. Because in this example I have W1 as the postal code and W13 is the other postal code No, you don't. In this example you have W1U as one outbound code and W13 as the ot

Re: Postal code searching

2012-04-24 Thread Grant Allen
That still leaves the question, what are the actual rules/business logic by which you want to group things and get their "abbreviations"? Are you adhering to Royal Mail/Post Office residual selection/direct selection rules, or do you have your own scheme? It seems like the latter ... the RM ru

Re: Postal code searching

2012-04-24 Thread Neil Tompkins
At the moment im concentrating on london postal codes but future would be us zip codes too On 24 Apr 2012, at 18:09, Rick James wrote: > Please be more precise about the rules. In the US, "12345-6789" would become > "12345". This would follow a different rule. > > Is your rule "stop after t

RE: Postal code searching

2012-04-24 Thread Rick James
Please be more precise about the rules. In the US, "12345-6789" would become "12345". This would follow a different rule. Is your rule "stop after the first digit"? That gets quite messy in SQL, and would be better done in an application code. See also http://dev.mysql.com/doc/refman/5.0/en/

Re: Postal code searching

2012-04-24 Thread Lars Nilsson
On Tue, Apr 24, 2012 at 12:24 PM, Tompkins Neil wrote: > How about if I want to only return postal codes that are like W1U 8JE > not W13 0SU. > > Because in this example I have W1 as the postal code and W13 is the other > postal code Perhaps something like following? Though, to be honest, I'm not

Re: Postal code searching

2012-04-24 Thread Gary Smith
On 24/04/2012 17:24, Tompkins Neil wrote: How about if I want to only return postal codes that are like W1U 8JE not W13 0SU. Because in this example I have W1 as the postal code and W13 is the other postal code Then you'd do: like 'W1 %' to return anything starting W1 like 'W13 %' to return an

Re: Postal code searching

2012-04-24 Thread Tompkins Neil
How about if I want to only return postal codes that are like W1U 8JE not W13 0SU. Because in this example I have W1 as the postal code and W13 is the other postal code On Tue, Apr 24, 2012 at 5:18 PM, Gary Smith wrote: > On 24/04/2012 17:16, Gary Smith wrote: > >> http://dev.mysql.com/doc/**r

Re: Postal code searching

2012-04-24 Thread Gary Smith
On 24/04/2012 17:16, Gary Smith wrote: http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html Specifically, replace % with _ as this means "match one character" not "match any number of characters". So, you can do: like "W1 %" like "W1_ %" etc. Oh, and you can also get really

Re: Postal code searching

2012-04-24 Thread Gary Smith
On 24/04/2012 17:11, Tompkins Neil wrote: Hi I've a number of different postal codes in a system for example WC1B 5JA WC1H 8EJ W1J 7BX W1H 7DL NW1 1NY I can use like statements for example SELECT * FROM postal_codes WHERE zip LIKE 'W1%' giving me W1J 7BX W1H 7DL In addition I have a number