Hi Frederick,
On Wed, 26 Sep 2001 19:08:59 +0000 (UTC), fklauschen@yahoo.com
(Frederick Klauschen) wrote:
>Hi Josh,
>
>I am really sorry to bother you again and I promise
>to buy a book after this problem is solved and
>stop asking these "beginners'" questions.
>But the last example-Query you sent me does not
>work, it produces:
>
>ERROR: parser: parse error at or near "("
>
>and I am sure, I entered it correctly.
>(I also tried on PostgreSQL Versions 7.0.3 and
>7.1.3)
>
it's strange! With 7.1.3 here I don't get any parser error, but
"ERROR: Attribute people_attributes.people_id must be GROUPed or used
in an aggregate function". So I changed Josh's statement to
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 GROUP BY people_id) matches, ( SELECT count(*) as attribute_count
FROMsearch_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;
and it seems to work now.
>Thank you very much,
>Frederick
HTH,Carl van Tast