pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Piotr Czekalski <pczekalski@techbaza.pl>
To: pgsql-sql@postgresql.org
Subject: Re: how to get row number in select query
Date: Thu, 27 Jan 2011 16:21:06 +0100
Message-ID: <4D418D62.4010906@techbaza.pl> (raw)
In-Reply-To: <090BC28FACC442EAA5D46B58F55480AE@marktestcr.marktest.pt>
References: <4D4047C1.5030208@encs.concordia.ca>
	<D25246ED495942DD8E5777F5F9439DD0@marktestcr.marktest.pt>
	<4D4181E9.2000305@encs.concordia.ca>
	<090BC28FACC442EAA5D46B58F55480AE@marktestcr.marktest.pt>

Gentelmen,

I follow this thread and I don't exactly get an idea of yours, but isn't 
is as simple as (example: table "web.files" contains one column named 
"fileurl" ):

select row_number() over(), X.fileurl from (select fileurl from 
web.files order by fileurl) X

The only disadvantage is that if you do want to order resultset you have 
to use "select from select" as numbers are added before order which may 
cause some performance troubles.

Regards,

Piotr

-- 

--------------------------------------------------------------
"TECHBAZA.PL" Sp. z o.o.
Technologie WEB, eDB&  eCommerce
OddziaƂ Gliwice
ul. Chorzowska 50
44-100 Gliwice
tel. (+4832) 7186081
fax. (+4832) 7003289





view thread (8+ messages)  latest in thread

Message-ID: <4D418D62.4010906@techbaza.pl>
Permalink:  ../4D418D62.4010906@techbaza.pl/
Also on:    postgresql.org/message-id/4D418D62.4010906@techbaza.pl

 · 

reply

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: pczekalski@techbaza.pl
  Subject: Re: how to get row number in select query
  In-Reply-To: <4D418D62.4010906@techbaza.pl>

* 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