pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Carl van Tast <vanTast@Pivot.at>
To: pgsql-sql@postgresql.org
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
Message-ID: <vmk4rt8q86cosb5tcnsj97jh42ml7ck90p@4ax.com> (raw)
References: <20010926184545.20714.qmail@web10108.mail.yahoo.com>

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




view thread (3+ messages)

Message-ID: <vmk4rt8q86cosb5tcnsj97jh42ml7ck90p@4ax.com>
Permalink:  ../vmk4rt8q86cosb5tcnsj97jh42ml7ck90p@4ax.com/
Also on:    postgresql.org/message-id/vmk4rt8q86cosb5tcnsj97jh42ml7ck90p@4ax.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: vanTast@Pivot.at
  Subject: Re: Query does not work: parse ERROR, Re: How to enter lists into database: Problems with solution.
  In-Reply-To: <vmk4rt8q86cosb5tcnsj97jh42ml7ck90p@4ax.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox