Subject RE: [firebird-support] last of the SQL
Author Svein Erling Tysvær
Firebird works on data sets and in a set there is no default understanding of FIRST or LAST. So there are several possible answers to your question:

This gets the last address alphabetically sorted according to the current collation:

select, max(staff.address) as address from staff
group by order by

This gets the last address depending on MoveDate, or the highest primary key if a person moved twice on the same date (OK, that's unlikely, but in different situations it may be good to know how to randomly pick one in case of equality):

select, s1.address from staff s1
where not exists(select * from staff s2
where =
and (s2.MoveDate > s1.MoveDate
or (s2.MoveDate = s1.MoveDate
and s2.PrimaryKeyField > s1.PrimaryKeyField)))


-----Original Message-----
From: [] On Behalf Of Ismael L. Donis Garc?a
Sent: 24. september 2009 09:51
Subject: [firebird-support] last of the SQL

What show substitutes the show last of the SQL?

Example: select, last(staff.address) as address from staff group
by order by

¦¦ ISMAEL ¦¦