Is the only way to make arbitrary queries from the DB to use an external script? I'm having a devil of a time creating something like: SELECT from_uri FROM acc WHERE to_uri LIKE '%<username at domain>%' AND sip_method='INVITE' ORDER BY TIME DESC LIMIT 1 Any ideas? Or am I stuck with external scripts? N.