From: | Carl van Tast <vanTast(at)Pivot(dot)at> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Query does not work: parse ERROR, Re: How to enter lists into database: Problems with solution. |
Date: | 2001-09-26 22:21:01 |
Message-ID: | vmk4rt8q86cosb5tcnsj97jh42ml7ck90p@4ax.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi Frederick,
On Wed, 26 Sep 2001 19:08:59 +0000 (UTC), fklauschen(at)yahoo(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Robin's PG-SQL List | 2001-09-26 22:43:51 | Aggregate Aggravation |
Previous Message | Frederick Klauschen | 2001-09-26 20:24:03 | PARSER ERROR |