SQL 2000 equivalent of "Last(x)"

  • Thread starter Thread starter RTL
  • Start date Start date
R

RTL

I can't seem to find that command in the SQL 2000 reference. By chance,
would any gurus know it? I have a query that is producing very bad reports
(off by 30K) with a query that _should be_ functionally equivalent; but is
not it seems. The only inherent difference is the Access SQL call uses
Last(x) function and SQL query does not.

Thanks in advance and enjoy your weekends,

Rich
 
Realistically, Last isn't a particular reliable function, since it depends
on the order of the records, and you can never assume anything about the
order of the records in a table. That means you must use a query with an
ORDER BY clause in order to be sure of the order. If your ORDER BY is
sorting in ascending order, reverse it to sort by descending order, and use
TOP 1 to get the last row.
 
Use;

"Select MAX(x)
from dbo.y"

where x is the unique identifier and y is the table name.


Regards,
 
Thank you both for responding. That did solve the problem...both produced
the results I was looking for.

Cheers,

Rich
 
Back
Top