The commas did not get cut off and I think I did not make any other mistakes either. Is it also possible that the parser does not work properly? Thanks, Frederick Here is what happened again: ERROR: parser: parse error at or near "(" when running : > SELECT people.people_id, people.name, > people.address, > people_attributes.attribute_name, > people_attributes.attribute_value > FROM people, people_attributes, > ( SELECT people_id, count(*) as match_count > FROM people_attributes, search_attributes > WHERE search_id = 31 > AND people_attributes.attribute_name = > search_attributes.attribute_name > AND people_attributes.attribute_value ~* > search_attributes.attribute_value ) > matches, > ( SELECT count(*) as attribute_count > FROM search_attributes > WHERE search_id = 31 ) searched > WHERE people.people_id = people_attributes.people_id > AND people.people_id = matches.people_id > AND matches.match_count = > searched.attribute_count; Postgresql Verson 7.0.3 and 7.1.3. __________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html