Re: Alternative to MS Access Last() function - Mailing list pgsql-novice

From Bruno Wolff III
Subject Re: Alternative to MS Access Last() function
Date
Msg-id 20060301192439.GB14141@wolff.to
Whole thread Raw
In response to Re: Alternative to MS Access Last() function  ("Scott Ford" <Scott.Ford@bullfrogpower.com>)
List pgsql-novice
On Wed, Mar 01, 2006 at 13:31:28 -0500,
  Scott Ford <Scott.Ford@bullfrogpower.com> wrote:
> Actually, I think I just figured it out.  I'm not sure that I totally
> understand it - I've been passed the problem of converting it from
> someone else.  But according to the documentation:
>
> -------------
> The LAST function returns the value of the last record in the specified
> field.
>
> Syntax:
> SELECT LAST(column) AS [expression]
> FROM table
>
> Example:
> SELECT LAST(Age) AS highest_age
> FROM Persons
> ORDER BY Age
> --------------
>
> So I think that I should just be able to use MAX().  Right?

You could more closely mimic this with a custom aggregate that returns the
value it was last input. However, depending on the context, you can probably
rewrite the queries to use max, min, or limit 1 with an an appropiate ordering
to do the same thing.

pgsql-novice by date:

Previous
From: "Lane Van Ingen"
Date:
Subject: Re: install
Next
From: Michael Fuhr
Date:
Subject: Re: Alternative to MS Access Last() function