Madison Kelly wrote:
nmc=> SELECT 'Y' AS local FROM domains WHERE '@'||dom_name IN
('mkelly@xxxxxxxx');
local
-------
(0 rows)
Not work?
I don't think IN does what you think it does. It's not a substring-test,
but a set test:
SELECT 1 WHERE 'x' IN ('a','b','c','x');
SELECT a FROM foo WHERE b IN (SELECT z FROM bar WHERE frozzled<>wamble);
You could mess around with substring() and length() or I'd use LIKE.
If it's just a domain you're looking for though, might be most efficient
to strip the leading part off your value with regexp_replace().
--
Richard Huxton
Archonet Ltd
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq