On Wed, Jan 21, 2009 at 5:44 PM, Keaton Adams <kadams@xxxxxxxxxxx> wrote: > Is there a way to do this in a single SQL statement in PostgreSQL 8.1? SELECT d.policyNumber , d.CompanyName , d.Address , p.AllPolicyNumbersIncluded FROM PolicyPrint p INNER JOIN PolicyDetails d ON ( p.cicPolicyNumber = d.policyNumber OR p.AllPolicyNumbersIncluded LIKE '%' || d.policyNumber || '%' ) -- OR -- SELECT d.policyNumber , d.CompanyName , d.Address , p.AllPolicyNumbersIncluded FROM PolicyPrint p INNER JOIN PolicyDetails d ON ( p.cicPolicyNumber = d.policyNumber OR d.policyNumber = ANY(string_to_array(p.AllPolicyNumbersIncluded, ',')) ) -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general