Mark Harrison <mh@xxxxxxxxx> writes: > I've got a query that depends upon two pieces of data from another table for > use in a where clause. > scratch1=# select id from p4_versions where > versionof=(select id from p4_files where p4path like '%/date.txt') > and > version=(select headver from p4_files where p4path like '%/date.txt'); Use a row-wise comparison, viz select id from p4_versions where (versionof, version) = (select id, headver from p4_files where p4path like '%/date.txt'); regards, tom lane