Re: [GENERAL] Re: [INTERFACES] the last row in a table

From: Marcin Grondecki <ojciec(at)mtl(dot)pl>
To: pgsql-general(at)hub(dot)org
Subject: Re: [GENERAL] Re: [INTERFACES] the last row in a table
Date: 1999-03-10 02:32:51
Message-ID: 3.0.6.32.19990309183251.007fd2a0@mtl.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces

At 15:20 99-03-09 +0000, you wrote:
>> I am developing a database with PostgreSQL in Linux, and using ecpg to
>> write the C program to communicate with the database.
>> One of my application need to get the data from the last row in a
>> table. Is there any function or command that can tract which is the
>> last row of data in a table?
>
>SQL is a set-oriented language. One should probably not assign any
>significance to a storage order of rows.
>
>It *is* possible to order the results of a query, and then your
>first/last qualities do have meaning. I would suggest ordering your
>query (perhaps on a "row update time" if by "the last row" you mean "the
>more recently entered row") using the "DESC" qualifier in the ORDER BY
>clause, then use a cursor to pick up the first row returned.
>
There is better answer, i think. Simply read smth about cursors - declaring,
using, droping. I think this is what u need.
In case of troubles with understanding, i'd serve with some examples in Perl.

Marcin Grondecki
ojciec(at)mtl(dot)pl
+48(604)468725
***** I'm not a complete idiot, some parts are missing...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marcin Grondecki 1999-03-10 03:02:03 Re: [GENERAL] Calcuate percentage.
Previous Message M Simms 1999-03-10 00:58:46 Database out of sync

Browse pgsql-interfaces by date

  From Date Subject
Next Message wlin 1999-03-10 03:38:39 perl-interface: make test
Previous Message Paul 1999-03-09 23:00:38 PHP