pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Serial number of a record
2+ messages / 2 participants
[nested] [flat]

* Serial number of a record
@ 2007-05-15 11:40  ashok@kalculate.com <ashok@kalculate.com>
  0 siblings, 1 reply; 2+ messages in thread

From: ashok@kalculate.com @ 2007-05-15 11:40 UTC (permalink / raw)
  To: pgsql-sql

Hi List,

I have one table something like this

Name          Age
=================
tom           20
ram           25
shyam         30
balram        15
hari          10

Now i want serial number of a record.
Suppose if i will fire a query "select Name from tablename where age=30".
it will give output "shyam" but i also want record no. other then oid, in
this case it is 3.

is it possible?
if yes then how?
plz. help me.

Thanks
Ashok

--------------------------------------------------------------------
mail2web.com - Microsoft® Exchange solutions from a leading provider -
http://link.mail2web.com/Business/Exchange





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Serial number of a record
@ 2007-05-15 13:36  Andrew Sullivan <ajs@crankycanuck.ca>
  parent: ashok@kalculate.com <ashok@kalculate.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Andrew Sullivan @ 2007-05-15 13:36 UTC (permalink / raw)
  To: pgsql-sql

On Tue, May 15, 2007 at 07:40:25AM -0400, ashok@kalculate.com wrote:
> Suppose if i will fire a query "select Name from tablename where age=30".
> it will give output "shyam" but i also want record no. other then oid, in
> this case it is 3.
> 
> is it possible?
> if yes then how?
> plz. help me.

This depends.  Does the record have a serialno field?  If not, you
can do it with a temporary sequence.  But you should be aware that
this "serial number" as you call it changes from result to result in
that case.

A

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
The whole tendency of modern prose is away from concreteness.
		--George Orwell



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-05-15 13:36 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-05-15 11:40 Serial number of a record ashok@kalculate.com <ashok@kalculate.com>
2007-05-15 13:36 ` Andrew Sullivan <ajs@crankycanuck.ca>

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