Given my two db tables aliases and subscriber have entries like this:
aliases.username = '5551234567'
aliases.contact = 'sip:[email protected]'
subscriber.username = 'a_sip_username'
I'd like to select only the matching rows that have subscriber.username within the aliases.contact field. This was my first attempt but it doesn't return anything:
SELECT
aliases.username as phone_number,
(@B:=subscriber.username) as user_name
FROM aliases,subscriber
WHERE aliases.contact regexp "^sip:@B[.*]"
Is this even possible or should I move the logic to the application?