Re: SQL query help!
От | Arcadius A. |
---|---|
Тема | Re: SQL query help! |
Дата | |
Msg-id | as36oc$2ss7$1@news.hub.org обсуждение исходный текст |
Ответ на | Re: SQL query help! (Luis Sousa <llsousa@ualg.pt>) |
Список | pgsql-sql |
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.
В списке pgsql-sql по дате отправления: