Re: Alternative to MS Access Last() function

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Scott Ford <Scott(dot)Ford(at)bullfrogpower(dot)com>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Alternative to MS Access Last() function
Date: 2006-03-01 19:24:39
Message-ID: 20060301192439.GB14141@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, Mar 01, 2006 at 13:31:28 -0500,
Scott Ford <Scott(dot)Ford(at)bullfrogpower(dot)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.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2006-03-01 19:25:18 Re: Alternative to MS Access Last() function
Previous Message Lane Van Ingen 2006-03-01 18:49:37 Re: install