Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f8QMY8h05930 for ; Wed, 26 Sep 2001 18:34:08 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id f8QMLDC58046 for pgsql-sql@postgresql.org; Wed, 26 Sep 2001 18:21:13 -0400 (EDT) (envelope-from news) From: Carl van Tast X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Query does not work: parse ERROR, Re: How to enter lists into database: Problems with solution. Date: Thu, 27 Sep 2001 00:21:01 +0200 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 52 Message-ID: References: <20010926184545.20714.qmail@web10108.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: scrappy@hub.org X-Newsreader: Forte Agent 1.8/32.548 To: pgsql-sql@postgresql.org X-Archive-Number: 200109/233 X-Sequence-Number: 4915 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 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; and it seems to work now. >Thank you very much, >Frederick HTH, Carl van Tast