From sandhyar@amiindia.co.in Tue May 16 12:47:51 2006 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id C0A6D9F9C18 for ; Tue, 16 May 2006 09:47:51 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 57303-03 for ; Tue, 16 May 2006 09:47:44 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from venus.amiindia.co.in (unknown [203.199.198.234]) by postgresql.org (Postfix) with ESMTP id 217049FA176 for ; Tue, 16 May 2006 09:47:36 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by venus.amiindia.co.in (8.12.11/8.12.11) with SMTP id k4GCe9Dj018270 for ; Tue, 16 May 2006 18:10:29 +0530 Received: from sandhyar (unknown [10.0.0.205])by venus.amiindia.co.in (Postfix) with ESMTP id 31FB93326D0; Tue, 16 May 2006 16:02:29 +0530 (IST) Message-ID: <03a101c678d6$1a24c670$cd00000a@sandhyar> From: "sandhya" To: "Postgres" Cc: "sandhya" Subject: reg:Query Date: Tue, 16 May 2006 16:16:55 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_039E_01C67904.26715730" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-imss-version: 2.040 X-imss-result: Passed X-imss-scanInfo: M:P L:E SM:0 X-imss-tmaseResult: TT:0 TS:0.0000 TC:00 TRN:0 TV:3.51.1032(14006.000) X-imss-scores: Clean:61.33854 C:2 M:4 S:5 R:5 X-imss-settings: Baseline:5 C:3 M:3 S:4 R:3 (0.2500 0.2500) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/209 X-Sequence-Number: 21741 This is a multi-part message in MIME format. ------=_NextPart_000_039E_01C67904.26715730 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Is there any query for possibility of getting only one row at a time in = a group of records? With distinct rows & Columns my query has to return only one record at a = time with out any condition.Will it be possible? Thank you, Sandhya ------=_NextPart_000_039E_01C67904.26715730 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi
 Is there any query for possibility of getting = only one=20 row at a time in a group of records?
 
With distinct rows & Columns my query has to = return only=20 one record at a time with out any condition.Will it be = possible?
 
Thank you,
Sandhya
 
------=_NextPart_000_039E_01C67904.26715730-- From andy.shellam@mailnetwork.co.uk Tue May 16 12:56:53 2006 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 249C09FA4E1 for ; Tue, 16 May 2006 09:56:53 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 58589-06 for ; Tue, 16 May 2006 09:56:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sydney.mailnetwork.co.uk (server88-208-192-113.live-servers.net [88.208.192.113]) by postgresql.org (Postfix) with ESMTP id F095D9FA176 for ; Tue, 16 May 2006 09:56:27 -0300 (ADT) Received: from [213.146.143.243] (port=10276 helo=it020361) by sydney.mailnetwork.co.uk with esmtpa (Exim 4.60) (envelope-from ) id 1Ffz65-0003c6-0O; Tue, 16 May 2006 13:56:21 +0100 Reply-To: From: "Andy Shellam" To: "'sandhya'" Cc: Subject: Re: reg:Query Date: Tue, 16 May 2006 13:56:47 +0100 Organization: the mail network Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0032_01C678F0.93442A40" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <03a101c678d6$1a24c670$cd00000a@sandhyar> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 Thread-Index: AcZ45zIapg3bfkwSRE2/hj1uyGZKKQAAJ9mA X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/210 X-Sequence-Number: 21742 This is a multi-part message in MIME format. ------=_NextPart_000_0032_01C678F0.93442A40 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit SELECT ... LIMIT 1 Will get the first row in the dataset. Then to fetch the next row, you can do SELECT .. LIMIT 1 OFFSET 1 (will get the 2nd record) and so on. (replace ... with your conditions, LIMIT must come at the end of the query) Andy _____ From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of sandhya Sent: 16 May 2006 11:47 am To: Postgres Cc: sandhya Subject: [ADMIN] reg:Query Hi Is there any query for possibility of getting only one row at a time in a group of records? With distinct rows & Columns my query has to return only one record at a time with out any condition.Will it be possible? Thank you, Sandhya !DSPAM:14,4469ca6434491997014324! ------=_NextPart_000_0032_01C678F0.93442A40 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

SELECT ….. LIMIT = 1

 

Will get the first row in the = dataset.  Then to fetch the next row, you can do SELECT …… LIMIT 1 = OFFSET 1 (will get the 2nd record) and so = on.

(replace ….. with your = conditions, LIMIT must come at the end of the query)

 

Andy

 


From: pgsql-admin-owner@postgresql.org = [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of sandhya
Sent: 16 May 2006 11:47 = am
To: Postgres
Cc: sandhya
Subject: [ADMIN] = reg:Query

 

Hi

 Is there any query for possibility of getting only one row = at a time in a group of records?

 

With distinct rows & Columns my query has to return only one = record at a time with out any condition.Will it be = possible?

 

Thank you,

Sandhya

 

!DSPAM:14,4469ca6434491997014324!

------=_NextPart_000_0032_01C678F0.93442A40-- From andy.shellam@mailnetwork.co.uk Tue May 16 13:05:52 2006 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 3E8D69FA4E1 for ; Tue, 16 May 2006 10:05:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 62778-01 for ; Tue, 16 May 2006 10:05:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sydney.mailnetwork.co.uk (server88-208-192-113.live-servers.net [88.208.192.113]) by postgresql.org (Postfix) with ESMTP id A08779F9F8F for ; Tue, 16 May 2006 10:05:33 -0300 (ADT) Received: from [213.146.143.243] (port=14418 helo=it020361) by sydney.mailnetwork.co.uk with esmtpa (Exim 4.60) (envelope-from ) id 1FfzEw-0003df-Ti; Tue, 16 May 2006 14:05:31 +0100 Reply-To: From: "Andy Shellam" To: "'sandhya'" Cc: Subject: FW: reg:Query Date: Tue, 16 May 2006 14:05:57 +0100 Organization: the mail network Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_003C_01C678F1.DB01FD70" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 Thread-Index: AcZ45zIapg3bfkwSRE2/hj1uyGZKKQAAJ9mAAABdtoA= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/212 X-Sequence-Number: 21744 This is a multi-part message in MIME format. ------=_NextPart_000_003C_01C678F1.DB01FD70 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Actually, just realized, this depends on your PGSQL version. The older format (pre-8.0 I believe) is SELECT ... LIMIT x, y (where x is the number of rows to fetch, and y is the offset (ie. Select x number of rows, starting from row y.) Andy _____ From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Andy Shellam Sent: 16 May 2006 1:57 pm To: 'sandhya' Cc: pgsql-admin@postgresql.org Subject: Re: [ADMIN] reg:Query SELECT ... LIMIT 1 Will get the first row in the dataset. Then to fetch the next row, you can do SELECT .. LIMIT 1 OFFSET 1 (will get the 2nd record) and so on. (replace ... with your conditions, LIMIT must come at the end of the query) Andy _____ From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of sandhya Sent: 16 May 2006 11:47 am To: Postgres Cc: sandhya Subject: [ADMIN] reg:Query Hi Is there any query for possibility of getting only one row at a time in a group of records? With distinct rows & Columns my query has to return only one record at a time with out any condition.Will it be possible? Thank you, Sandhya !DSPAM:14,4469cd4d34491667573013! ------=_NextPart_000_003C_01C678F1.DB01FD70 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Actually, just realized, this = depends on your PGSQL version. 

 

The older format (pre-8.0 I = believe) is SELECT ….. LIMIT x, y  (where x is the number of rows to = fetch, and y is the offset (ie. Select x number of rows, starting from row = y.)

 

Andy

 


From: pgsql-admin-owner@postgresql.org = [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Andy Shellam
Sent: 16 May 2006 1:57 = pm
To: 'sandhya'
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] = reg:Query

 

SELECT ….. LIMIT = 1

 

Will get the first row in the dataset.  Then to fetch the next row, you can do SELECT = …… LIMIT 1 OFFSET 1 (will get the 2nd record) and so = on.

(replace ….. with your = conditions, LIMIT must come at the end of the query)

 

Andy

 


From: pgsql-admin-owner@postgresql.org = [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of sandhya
Sent: 16 May 2006 11:47 = am
To: Postgres
Cc: sandhya
Subject: [ADMIN] = reg:Query

 

Hi

 Is there any query for possibility of getting only one row = at a time in a group of records?

 

With distinct rows & Columns my query has to return only one = record at a time with out any condition.Will it be = possible?

 

Thank you,

Sandhya

 

 

!DSPAM:14,4469cd4d34491667573013!

------=_NextPart_000_003C_01C678F1.DB01FD70-- From sandhyar@amiindia.co.in Tue May 16 13:05:14 2006 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 4019F9FA176 for ; Tue, 16 May 2006 10:05:14 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 61042-01 for ; Tue, 16 May 2006 10:04:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from venus.amiindia.co.in (unknown [203.199.198.234]) by postgresql.org (Postfix) with ESMTP id CA01E9F9F8F for ; Tue, 16 May 2006 10:04:37 -0300 (ADT) Received: from venus.amiindia.co.in (localhost.localdomain [127.0.0.1]) by venus.amiindia.co.in (8.12.11/8.12.11) with ESMTP id k4GCvNLc021279; Tue, 16 May 2006 18:27:23 +0530 Received: from sandhyar (unknown [10.0.0.205])by venus.amiindia.co.in (Postfix) with ESMTP id EC63A332695; Tue, 16 May 2006 18:27:22 +0530 (IST) Message-ID: <03f701c678ea$5e1124a0$cd00000a@sandhyar> From: "sandhya" To: Cc: , "Nabil Aziz Sawaya" References: Subject: Re: reg:Query Date: Tue, 16 May 2006 18:42:21 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_03F4_01C67918.77416BF0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-imss-version: 2.040 X-imss-result: Passed X-imss-scanInfo: M:P L:E SM:0 X-imss-tmaseResult: TT:0 TS:0.0000 TC:00 TRN:0 TV:3.51.1032(14006.000) X-imss-scores: Clean:57.14837 C:2 M:4 S:5 R:5 X-imss-settings: Baseline:5 C:3 M:3 S:4 R:3 (0.2500 0.2500) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/211 X-Sequence-Number: 21743 This is a multi-part message in MIME format. ------=_NextPart_000_03F4_01C67918.77416BF0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thank you..... ----- Original Message -----=20 From: Andy Shellam=20 To: 'sandhya'=20 Cc: pgsql-admin@postgresql.org=20 Sent: Tuesday, May 16, 2006 6:26 PM Subject: RE: [ADMIN] reg:Query SELECT ... LIMIT 1 =20 Will get the first row in the dataset. Then to fetch the next row, = you can do SELECT .. LIMIT 1 OFFSET 1 (will get the 2nd record) and so = on. (replace ... with your conditions, LIMIT must come at the end of the = query) =20 Andy =20 -------------------------------------------------------------------------= ----- From: pgsql-admin-owner@postgresql.org = [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of sandhya Sent: 16 May 2006 11:47 am To: Postgres Cc: sandhya Subject: [ADMIN] reg:Query =20 Hi Is there any query for possibility of getting only one row at a time = in a group of records? =20 With distinct rows & Columns my query has to return only one record at = a time with out any condition.Will it be possible? =20 Thank you, Sandhya =20 !DSPAM:14,4469ca6434491997014324!=20 ------=_NextPart_000_03F4_01C67918.77416BF0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Thank you.....
----- Original Message -----
From:=20 Andy Shellam
Sent: Tuesday, May 16, 2006 = 6:26 PM
Subject: RE: [ADMIN] = reg:Query

SELECT = =85.. LIMIT=20 1

 

Will get = the first=20 row in the dataset.  Then to fetch the next row, you can do = SELECT =85=85=20 LIMIT 1 OFFSET 1 (will get the 2nd record) and so=20 on.

(replace = =85.. with=20 your conditions, LIMIT must come at the end of the=20 query)

 

Andy

 


From: pgsql-admin-owner@postgr= esql.org=20 [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of = sandhya
Sent: 16 May 2006 11:47 = am
To: Postgres
Cc: sandhya
Subject: [ADMIN]=20 reg:Query

 

Hi

 Is there any query for possibility of = getting=20 only one row at a time in a group of=20 records?

 

With distinct rows & Columns my query = has to=20 return only one record at a time with out any condition.Will it be=20 possible?

 

Thank = you,

Sandhya

 

!DSPAM:14,4469ca6434491997014324!=20

------=_NextPart_000_03F4_01C67918.77416BF0-- From andy.shellam@mailnetwork.co.uk Tue May 16 13:28:07 2006 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 4ED229FA48C for ; Tue, 16 May 2006 10:28:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 63514-05 for ; Tue, 16 May 2006 10:27:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sydney.mailnetwork.co.uk (server88-208-192-113.live-servers.net [88.208.192.113]) by postgresql.org (Postfix) with ESMTP id 574D39FA176 for ; Tue, 16 May 2006 10:27:46 -0300 (ADT) Received: from [213.146.143.243] (port=23499 helo=it020361) by sydney.mailnetwork.co.uk with esmtpa (Exim 4.60) (envelope-from ) id 1FfzaS-0003jN-6R; Tue, 16 May 2006 14:27:44 +0100 Reply-To: From: "Andy Shellam" To: "'sandhya'" Cc: Subject: Re: reg:Query Date: Tue, 16 May 2006 14:28:11 +0100 Organization: the mail network Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <040c01c678ec$9ef243d0$cd00000a@sandhyar> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 Thread-Index: AcZ464RdxdfKJnfrSOCiypw8BY+zpwAABsog X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/214 X-Sequence-Number: 21746 Depends on which version of Postgres you=92re using (pre-8.0 or = post-8.0) I think the format changed from v8.0 onwards. So, for example, = post-8.0: SELECT email_address FROM account_details ORDER BY address_id = LIMIT 1 OFFSET 0; Will bring back the first row. The following will bring back the next = and so on: SELECT email_address FROM account_details ORDER BY address_id LIMIT 1 OFFSET 1; Pre-8.0 the queries would be:=20 SELECT email_address FROM account_details ORDER BY address_id = LIMIT 1, 0; SELECT email_address FROM account_details ORDER BY address_id = LIMIT 1, 1; =20 Note LIMIT 1, 0 (and LIMIT 1 OFFSET 0) is the same as LIMIT 1 Andy ________________________________________ From: sandhya [mailto:sandhyar@amiindia.co.in]=20 Sent: 16 May 2006 2:28 pm To: andy.shellam@mailnetwork.co.uk Cc: pgsql-admin@postgresql.org Subject: Re: [ADMIN] reg:Query yes..I got it. SELECT .................... LIMIT x OFFSET y.Am i right? ----- Original Message -----=20 From: Andy Shellam=20 To: 'sandhya'=20 Cc: pgsql-admin@postgresql.org=20 Sent: Tuesday, May 16, 2006 6:35 PM Subject: FW: [ADMIN] reg:Query Actually, just realized, this depends on your PGSQL version.=A0=20 The older format (pre-8.0 I believe) is SELECT =85.. LIMIT x, y=A0 = (where x is the number of rows to fetch, and y is the offset (ie. Select x number of rows, starting from row y.) Andy ________________________________________ From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Andy Shellam Sent: 16 May 2006 1:57 pm To: 'sandhya' Cc: pgsql-admin@postgresql.org Subject: Re: [ADMIN] reg:Query SELECT =85.. LIMIT 1 Will get the first row in the dataset.=A0 Then to fetch the next row, = you can do SELECT =85=85 LIMIT 1 OFFSET 1 (will get the 2nd record) and so on. (replace =85.. with your conditions, LIMIT must come at the end of the = query) Andy ________________________________________ From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of sandhya Sent: 16 May 2006 11:47 am To: Postgres Cc: sandhya Subject: [ADMIN] reg:Query Hi =A0Is there any query for possibility of getting only one row at a time = in a group of records? =A0 With distinct rows & Columns my query has to return only one record at a time with out any condition.Will it be possible? =A0 Thank you, Sandhya =A0 !DSPAM:14,4469d1a234495652214946!=20 From sandhyar@amiindia.co.in Tue May 16 13:21:03 2006 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 7462D9F9F8F for ; Tue, 16 May 2006 10:21:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 64748-02 for ; Tue, 16 May 2006 10:20:43 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from venus.amiindia.co.in (unknown [203.199.198.234]) by postgresql.org (Postfix) with ESMTP id 55AFA9FA176 for ; Tue, 16 May 2006 10:20:37 -0300 (ADT) Received: from venus.amiindia.co.in (localhost.localdomain [127.0.0.1]) by venus.amiindia.co.in (8.12.11/8.12.11) with ESMTP id k4GDDVEK023911; Tue, 16 May 2006 18:43:37 +0530 Received: from sandhyar (unknown [10.0.0.205])by venus.amiindia.co.in (Postfix) with ESMTP id 46194332681; Tue, 16 May 2006 18:43:31 +0530 (IST) Message-ID: <040c01c678ec$9ef243d0$cd00000a@sandhyar> From: "sandhya" To: Cc: References: Subject: Re: reg:Query Date: Tue, 16 May 2006 18:58:28 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0409_01C6791A.B803B880" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-imss-version: 2.040 X-imss-result: Passed X-imss-scanInfo: M:P L:E SM:0 X-imss-tmaseResult: TT:0 TS:0.0000 TC:00 TRN:0 TV:3.51.1032(14006.000) X-imss-scores: Clean:87.85964 C:2 M:4 S:5 R:5 X-imss-settings: Baseline:5 C:3 M:3 S:4 R:3 (0.2500 0.2500) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/213 X-Sequence-Number: 21745 This is a multi-part message in MIME format. ------=_NextPart_000_0409_01C6791A.B803B880 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable yes..I got it. SELECT .................... LIMIT x OFFSET y.Am i right? ----- Original Message -----=20 From: Andy Shellam=20 To: 'sandhya'=20 Cc: pgsql-admin@postgresql.org=20 Sent: Tuesday, May 16, 2006 6:35 PM Subject: FW: [ADMIN] reg:Query Actually, just realized, this depends on your PGSQL version. =20 =20 The older format (pre-8.0 I believe) is SELECT ... LIMIT x, y (where = x is the number of rows to fetch, and y is the offset (ie. Select x = number of rows, starting from row y.) =20 Andy =20 -------------------------------------------------------------------------= ----- From: pgsql-admin-owner@postgresql.org = [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Andy Shellam Sent: 16 May 2006 1:57 pm To: 'sandhya' Cc: pgsql-admin@postgresql.org Subject: Re: [ADMIN] reg:Query =20 SELECT ... LIMIT 1 =20 Will get the first row in the dataset. Then to fetch the next row, = you can do SELECT .. LIMIT 1 OFFSET 1 (will get the 2nd record) and so = on. (replace ... with your conditions, LIMIT must come at the end of the = query) =20 Andy =20 -------------------------------------------------------------------------= ----- From: pgsql-admin-owner@postgresql.org = [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of sandhya Sent: 16 May 2006 11:47 am To: Postgres Cc: sandhya Subject: [ADMIN] reg:Query =20 Hi Is there any query for possibility of getting only one row at a time = in a group of records? =20 With distinct rows & Columns my query has to return only one record at = a time with out any condition.Will it be possible? =20 Thank you, Sandhya =20 =20 !DSPAM:14,4469cd4d34491667573013!=20 ------=_NextPart_000_0409_01C6791A.B803B880 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
yes..I got it.
SELECT .................... LIMIT x OFFSET y.Am i=20 right?
----- Original Message -----
From:=20 Andy Shellam
Sent: Tuesday, May 16, 2006 = 6:35 PM
Subject: FW: [ADMIN] = reg:Query

Actually, = just=20 realized, this depends on your PGSQL version. =20

 

The older = format=20 (pre-8.0 I believe) is SELECT =85.. LIMIT x, y  (where x is the = number of=20 rows to fetch, and y is the offset (ie. Select x number of rows, = starting from=20 row y.)

 

Andy

 


From: pgsql-admin-owner@postgr= esql.org=20 [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Andy = Shellam
Sent: 16 May 2006 1:57 = pm
To: 'sandhya'
Cc: pgsql-admin@postgresql.org=
Subject: Re: [ADMIN]=20 reg:Query

 

SELECT = =85.. LIMIT=20 1

 

Will get = the first=20 row in the dataset.  Then to fetch the next row, you can do = SELECT =85=85=20 LIMIT 1 OFFSET 1 (will get the 2nd record) and so=20 on.

(replace = =85.. with=20 your conditions, LIMIT must come at the end of the=20 query)

 

Andy

 


From:=20 pgsql-admin-owner@postgresql.org = [mailto:pgsql-admin-owner@postgresql.org]=20 On Behalf Of = sandhya
Sent:
16 May 2006 11:47 = am
To: Postgres
Cc: sandhya
Subject: [ADMIN]=20 reg:Query

 

Hi

 Is there any query for possibility of = getting=20 only one row at a time in a group of=20 records?

 

With distinct rows & Columns my query = has to=20 return only one record at a time with out any condition.Will it be=20 possible?

 

Thank = you,

Sandhya

 

 

!DSPAM:14,4469cd4d34491667573013!=20

------=_NextPart_000_0409_01C6791A.B803B880-- From kdeugau@vianet.ca Tue May 16 14:40:34 2006 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 357249F9F8F for ; Tue, 16 May 2006 11:40:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 78712-09 for ; Tue, 16 May 2006 11:40:10 -0300 (ADT) X-Greylist: delayed 00:06:29.642108 by SQLgrey- Received: from smtp.vianet.ca (smtp.vianet.ca [209.91.128.40]) by postgresql.org (Postfix) with SMTP id C71899F9C18 for ; Tue, 16 May 2006 11:40:04 -0300 (ADT) Received: (qmail 4187 invoked from network); 16 May 2006 14:33:23 -0000 Received: from unknown (HELO ?192.168.99.15?) (209.91.179.117) by smtp.vianet.ca with SMTP; 16 May 2006 14:33:23 -0000 Message-ID: <4469E28A.90207@vianet.ca> Date: Tue, 16 May 2006 10:32:42 -0400 From: Kris Deugau Reply-To: pgsql-admin@postgresql.org Organization: ViaNet User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: reg:Query References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/216 X-Sequence-Number: 21748 Andy Shellam wrote: > Depends on which version of Postgres you’re using (pre-8.0 or post-8.0) > > I think the format changed from v8.0 onwards. So, for example, post-8.0: > > SELECT email_address FROM account_details ORDER BY address_id LIMIT 1 > OFFSET 0; > > Will bring back the first row. The following will bring back the next and > so on: > > SELECT email_address FROM account_details ORDER BY address_id LIMIT > 1 OFFSET 1; > > Pre-8.0 the queries would be: > > SELECT email_address FROM account_details ORDER BY address_id LIMIT > 1, 0; > SELECT email_address FROM account_details ORDER BY address_id LIMIT > 1, 1; Curious; I've never seen this format. I've been using the first for some time now with 7.2.something (Debian Woody), and more recently 7.4.something (Debian Sarge). No problems. Most access is via Perl DBI, but the exact same SQL works just fine from a psql shell. -kgd From andy.shellam@mailnetwork.co.uk Tue May 16 14:53:35 2006 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 1D0229FA176 for ; Tue, 16 May 2006 11:53:35 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 78820-09 for ; Tue, 16 May 2006 11:53:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sydney.mailnetwork.co.uk (server88-208-192-113.live-servers.net [88.208.192.113]) by postgresql.org (Postfix) with ESMTP id AA79E9F9C18 for ; Tue, 16 May 2006 11:53:08 -0300 (ADT) Received: from [213.146.143.243] (port=61496 helo=it020361) by sydney.mailnetwork.co.uk with esmtpa (Exim 4.60) (envelope-from ) id 1Fg0v3-0003wb-0x; Tue, 16 May 2006 15:53:05 +0100 Reply-To: From: "Andy Shellam" To: Cc: Subject: Re: reg:Query Date: Tue, 16 May 2006 15:53:31 +0100 Organization: the mail network Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <4469E28A.90207@vianet.ca> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 Thread-Index: AcZ491oRUDZedxsaTTeJx+gi5dOUdAAAER2Q X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/217 X-Sequence-Number: 21749 Kgd, I think it changed in 8.0 onwards. I used an application that was written for 7.4 on my 8.0.3 server, and it threw up errors at the LIMIT statements, saying the "LIMIT X,Y" format was deprecated, and to use "LIMIT X OFFSET Y" instead - so I had to have much of the application queries rewritten. Ref: section 7.6 in the 8.1-series manual. I'm sure you could use both pre-8.0 - it's just that the LIMIT X,Y format was withdrawn after 8.0. Andy > > Curious; I've never seen this format. I've been using the first for > some time now with 7.2.something (Debian Woody), and more recently > 7.4.something (Debian Sarge). No problems. Most access is via Perl > DBI, but the exact same SQL works just fine from a psql shell. > > -kgd > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > > !DSPAM:14,4469e57e34496068418624! > From kdeugau@vianet.ca Tue May 16 16:06:54 2006 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 075E39FA15C for ; Tue, 16 May 2006 13:06:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 96539-02 for ; Tue, 16 May 2006 13:06:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.vianet.ca (smtp.vianet.ca [209.91.128.40]) by postgresql.org (Postfix) with SMTP id 4E9809F9C9E for ; Tue, 16 May 2006 13:06:46 -0300 (ADT) Received: (qmail 31775 invoked from network); 16 May 2006 16:06:46 -0000 Received: from unknown (HELO ?192.168.99.15?) (209.91.179.117) by smtp.vianet.ca with SMTP; 16 May 2006 16:06:46 -0000 Message-ID: <4469F86D.7040706@vianet.ca> Date: Tue, 16 May 2006 12:06:05 -0400 From: Kris Deugau Reply-To: pgsql-admin@postgresql.org Organization: ViaNet User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: reg:Query References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/218 X-Sequence-Number: 21750 [Please keep mail on-list; I don't need multiple copies. Thanks.] Andy Shellam wrote: > I think it changed in 8.0 onwards. > > I used an application that was written for 7.4 on my 8.0.3 server, and it > threw up errors at the LIMIT statements, saying the "LIMIT X,Y" format was > deprecated, and to use "LIMIT X OFFSET Y" instead - so I had to have much of > the application queries rewritten. > > Ref: section 7.6 in the 8.1-series manual. > > I'm sure you could use both pre-8.0 - it's just that the LIMIT X,Y format > was withdrawn after 8.0. Er, that's what I meant: I've never seen the LIMIT X,Y format, but I've been using the LIMIT X OFFSET Y format with both 7.2 and 7.4. (Actually, IIRC, this is one of the few bits of code of any kind in my particular app that's still hanging around from before I took over maintenance... when it ran on MySQL. I quickly switched over to Postgres for quite a long list of reasons.) Your earlier messages in the thread seemed to imply that LIMIT X,Y was the ONLY format that would work pre-8.0. Which definitely isn't the case - unless I've been using some mutated third-party-patched versions of Postgres. (Entirely possible given that I usually install distribution packages rather than build-from-source- although I'd be very surprised if this was one of the changes.) -kgd From andy.shellam@mailnetwork.co.uk Tue May 16 16:18:32 2006 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 0E4CE9FA15C for ; Tue, 16 May 2006 13:18:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 98414-04 for ; Tue, 16 May 2006 13:18:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sydney.mailnetwork.co.uk (server88-208-192-113.live-servers.net [88.208.192.113]) by postgresql.org (Postfix) with ESMTP id BACF99F9C9E for ; Tue, 16 May 2006 13:18:21 -0300 (ADT) Received: from [213.146.143.243] (port=32436 helo=it020361) by sydney.mailnetwork.co.uk with esmtpa (Exim 4.60) (envelope-from ) id 1Fg2FX-00048Q-BY for pgsql-admin@postgresql.org; Tue, 16 May 2006 17:18:19 +0100 Reply-To: From: "Andy Shellam" To: Subject: Re: reg:Query Date: Tue, 16 May 2006 17:18:28 +0100 Organization: the mail network Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <4469F86D.7040706@vianet.ca> Thread-Index: AcZ5AuXdJyTR46pgSTyiAULXdK3wUwAAKxUg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/219 X-Sequence-Number: 21751 > Your earlier messages in the thread seemed to imply that LIMIT X,Y was > the ONLY format that would work pre-8.0. I had 2 applications that used the LIMIT X,Y format, and having started out with Postgres on 8.0.0 (only touching base with 7.4), plus coming from a mySQL background (which did use LIMIT X,Y) I wasn't aware you could use both formats in 7.X - but useful to know thanks.