[Asterisk-Users] OT : For the SQL gurus..

WipeOut wipe_out at onetel.com
Mon Nov 10 02:56:14 MST 2003


SQL help needed..

If I have a MySQL table with dialing codes and a corresponding 
description (see below) and I want to lookup the best match for a phone 
number.. What would the SQL look like to do it? or would it take more 
than just SQL to get to the best result?

Thanks..

Later..

Example numbers, (random end digits so I don't know who's they are.)

00442085673456 - UK London
00441273786524 - UK Geographic
00441444456789 - UK Geographic
00447796345678 - Vodafone Mobile
00447930987321 - O2 Mobile
0027117654321 - South Africa
0016047863252 - USA/Canada
______________________
Code       |        Data
-----------------------------------
001            USA/Canada
0027          South Africa
0031          Netherlands
0032          Belguim
0033          France
0034          Spain
0039          Italy
0041          Switzerland
0043          Austria
0045          Denmark
0046          Sweden
0047          Norway
0049          Germany
00441        UK geographic
00442        UK geographic
0044207    UK London
0044208    UK London
0044370    Vodafone
0044378    Vodafone
0044390    Vodafone
0044401    O2
0044402    O2
0044403    O2
0044408    O2
0044410    O2
0044411    O2
0044421    Vodafone
0044467    Vodafone
0044468    Vodafone
0044585    O2
0044589    O2
0044770    O2
0044771    O2
0044775    O2
0044779    Vodafone
0044783    Vodafone
0044793    T-Mobile
0044794    T-Mobile
0044795    T-Mobile
0044797    Orange
0044799    Vodafone
0044080    Free call
0044802    O2
0044831    Vodafone
0044836    Vodafone
0044845    Local Rate
0044850    O2
0044860    O2
0044870    National rate
0044966    Orange
0044973    Orange
0044976    Orange
0044990    UK geographic




More information about the asterisk-users mailing list