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(at)test(dot)com');
>
> 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(at)test(dot)com' in 'dom_name'?
Something like:
SELECT ... FROM domains d WHERE ('%@' || d.dom_name) LIKE 'mkelly(at)test(dot)com';
--
Richard Huxton
Archonet Ltd