Unix Technical Forum

Serial number of a record

This is a discussion on Serial number of a record within the pgsql Sql forums, part of the PostgreSQL category; --> Hi List, I have one table something like this Name Age ================= tom 20 ram 25 shyam 30 balram ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Sql

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 03:25 PM
ashok@kalculate.com
 
Posts: n/a
Default Serial number of a record

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



---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 03:25 PM
Andrew Sullivan
 
Posts: n/a
Default Re: Serial number of a record

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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com