Hi
I have a query which select the correct prefix from the lcr table, but have realised that it my be incorrect, is anyone else using something similiar for rating
SELECT prefix from lcr WHERE 'sip:1234@sip.domain.com' LIKE lcr.from_uri AND '35387318220' LIKE CONCAT(lcr.prefix, '%') ORDER BY CHAR_LENGTH(lcr.prefix), lcr.priority DESC, RAND() ;
Now this returns
+--------+ | prefix | +--------+ | 353 | | 3538 | | 35387 | +--------+
Now I assume you should pick the one with the best match, i.e at the bottom, if so should the query not have ASC no desc in the query, rather than having to add another line which takes all result and sees length of each.
Iqbal