I want to do a complicated SQL query as follows:
"(SELECT messages.msgid FROM messages, subject_index WHERE
((subject_index.word='Hello' or subject_index.word='There') and
(subject_index.msgid = messages.msgid))
GROUP BY messages.msgid HAVING count(messages.msgid)=2)
(SELECT messages.msgid FROM messages, author_index WHERE
((author_index.word='Jim' or author_index.word='Jones') and
(author_index.msgid = messages.msgid))
GROUP BY messages.msgid HAVING count(messages.msgid)=2);"
The first SELECT is supposed to find messages whose subject contains
both 'Hello' and 'There'. The second SELECT is supposed to find all
messages in which the author contains both 'Jim' and 'Jones'. Each work
fine independently, but given me an error when combined with INTERSECT.
PGSQL doesn't accept the combination. It gives me this error message:
"SELECT / HAVING requires aggregates to be valid".
Can somebody explain what this means, and how I should fix it?
Keith L. Musser
Integrated Dynamics, Inc.
pgsql-general by date
|Next:||From: Ashley Clark||Date: 2000-10-31 02:36:12|
|Subject: Re: list configuration|
|Previous:||From: Roderick A. Anderson||Date: 2000-10-30 23:25:28|
|Subject: Chained table entries|