Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2D1aRx15554 for ; Mon, 12 Mar 2001 20:36:27 -0500 (EST) (envelope-from pgsql-admin-owner@postgresql.org) Received: from neouvielle.enseirb.fr (neouvielle.enseirb.fr [147.210.18.138]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2D1BUx10596 for ; Mon, 12 Mar 2001 20:11:40 -0500 (EST) (envelope-from spy@joystick.fr) Received: from joystick.fr (bayet@tanit [147.210.18.1]) by neouvielle.enseirb.fr (8.9.3/8.9.3) with ESMTP id CAA20056; Tue, 13 Mar 2001 02:09:26 +0100 (MET) Message-ID: <3AAD785A.2DAEDCE@joystick.fr> Date: Tue, 13 Mar 2001 02:31:06 +0100 From: Spy X-Mailer: Mozilla 4.75 [fr] (X11; U; Linux 2.2.17-21mdk i686) X-Accept-Language: en MIME-Version: 1.0 To: Tom Lane , pgsql-admin@postgresql.org Subject: Re: Use of the LIMIT clause ? References: <3AADBFD7.D462E190@enseirb.fr> <7612.984439579@sss.pgh.pa.us> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Archive-Number: 200103/97 X-Sequence-Number: 945 Tom Lane a écrit : > > Richard Bayet writes: > > I did knew about this, but the author goes further about the "limit > > N,P", which allows someone to get only results between the Nth and Pth > > lines of the whole result... > > Is that actually how MySQL interprets two parameters? We treat them > as count and offset respectively, which definition I thought was the > same as MySQL's. Well, it looks like the web site I read the piece of information from was mistaking... But MySQL's syntax is different, as found on http://www.mysql.com/doc/S/E/SELECT.html : "SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] [...] [LIMIT [offset,] rows]" > > > I tried this with psql, but couldn't get anything but parse errors. > > Works for me: > > regression=# select unique1 from tenk1 limit 10; > unique1 > --------- > 8800 > 1891 > 3420 > 9850 > 7164 > 8009 > 5057 > 6701 > 4321 > 3043 > (10 rows) > > regression=# select unique1 from tenk1 limit 3,5; > unique1 > --------- > 8009 > 5057 > 6701 > (3 rows) > > regression=# > > What PG version are you running? I'm using v.7.0.2, and the above examples worked for me :) When I tried using the LIMIT clause the first times, to obtain the same results, I would have tried "select unique1 from tenk1 limit 5,8", ie "limit start, stop" Then I would have got : unique1 --------- 4321 3043 (2 rows) What I tried and didn't work was the same as "select unique1 from tenk1 limit 5,10" (in my mind, getting the five last rows)... Thanks for your help > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org