[Asterisk-Users] Re: OT : For the SQL gurus..
Roy Sigurd Karlsbakk
roy at karlsbakk.net
Mon Nov 10 07:17:11 MST 2003
> You could also try this one to see which one is faster:
>
> SELECT *, length(code)
> FROM a
> WHERE code = '00442085673456'
> OR code = '0044208567345'
> OR code = '004420856734'
> OR code = '00442085673'
> OR code = '0044208567'
> OR code = '004420856'
> OR code = '00442085'
> OR code = '0044208'
> OR code = '004420'
> OR code = '00442'
> OR code = '0044'
> ORDER BY length(code) DESC;
>
> Again, the first row in the result set is the one you are after.
...or you could do the 'only right thing':
- Move to pgSQL and write a stored procedure to do it
roy
More information about the asterisk-users
mailing list