Hello,
I’m using Asterisk 13.13.1 with a ODBC/MySQL back-end.
I’d like to write a query like: “if given CallerID is found in MYTABLE, then return corresponding LocationCode if this LocationCode is set, else, if LocationCode is not set or no row found, then return a default value”
I’ve tried directly in isql console, variations of the bellow query:
SELECT COALESCE(DID.loccode, 12345) AS MYCODE FROM DID WHERE ‘+123456789’ BETWEEN DID.did_start AND DID.did_end
±--------------------------------------------------------------------------------+
| MYCODE |
±--------------------------------------------------------------------------------+
±--------------------------------------------------------------------------------+
Any tip ?
Best regards