Madison Kelly wrote:
SELECT 'Y' AS local FROM domains d, users u WHERE u.usr_dom_id=d.dom_id
AND u.usr_email||'@'||d.dom_name IN ('mkelly@xxxxxxxx');
Though this may not be the most efficient. In my case, the 'usr_email'
is the LHS of the '@' sign and 'dom_name' is the domain name. If I
wanted to use (I)LIKE, how would I have matched just the domain section
of 'mkelly@xxxxxxxx' in 'dom_name'?
Something like:
SELECT ... FROM domains d WHERE ('%@' || d.dom_name) LIKE 'mkelly@xxxxxxxx';
--
Richard Huxton
Archonet Ltd
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend