Hi All, I am working with some call processing.
I have one table with call detail records (cdrs) with a phone number in it : 0111234567890 I have another table with rates in it based on the dial number with the 011 stripped off. There may be unique rates for 1234.... 1235.... 1236.... 1237.... 1238.... 1239.... 1230.... Right now, this processing is done by taking the first 8 digits of the dialed number, doing a query Select * from rates where code=12345678 And seeing if there is a match, then taking 7 digits, seeing if there is a match, etc.... There is a chance it could come down to 2 digits, so that could be 6 queries, per cdr Right now, as the rates for one code are found, they are loaded into an array in perl and the next time that code comes up, the array is first checked before it does any more queries. I was just wondering if anyone had a better solution to be able to find the longest sub string match right in SQL. Thanks!! George Law -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]