From: Arcadius A. <ahouans@sh.cvut.cz>
To: pgsql-sql@postgresql.org
Subject: Re: SQL query help!
Date: Wed, 27 Nov 2002 20:34:32 +0100
Message-ID: <as36oc$2ss7$1@news.hub.org> (raw)
References: <3DE498E4.2050002@ualg.pt>
Hello!
"Luis Sousa" <llsousa@ualg.pt> wrote in message
news:3DE498E4.2050002@ualg.pt...
> This is a cryptographically signed message in MIME format.
>
> --------------ms080209060900030807050408
> Content-Type: text/plain; charset=us-ascii; format=flowed
> Content-Transfer-Encoding: 7bit
>
> Tell me what did you try with limit and group by.
> Where's IN, why don't you use EXISTS instead. It runs much master !
>
Thanks for the reply!
Alright, I'll use EXISTS instead of IN .... I didn't know that EXISTS is
faster.....
About my query, I have tried :
"
SELECT * FROM entry where isapproved='y' AND EXISTS (SELECT id
FROM subcategory WHERE catid='2') ORDER BY subcatid DESC LIMIT 5;
";
This will return only 5 rows....
But when I add the GROUP BY, then I got error
"
SELECT * FROM entry where isapproved='y' AND EXISTS (SELECT id
FROM subcategory WHERE catid='2') ORDER BY subcatid DESC LIMIT 5 GROUP BY
subcatid;
"
: ERROR: parser: parse error at or near "GROUP"
Thanks.....
Arcadius.
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: ahouans@sh.cvut.cz
Subject: Re: SQL query help!
In-Reply-To: <as36oc$2ss7$1@news.hub.org>
* 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