Re: How to do this - SQL

From: David Ferguson <DavidFerguson_at_csi.com>
Date: Wed, 7 Oct 1998 10:14:26 -0400
Message-ID: <#W29PBg89GA.186_at_nih2naab.prod2.compuserve.com>


>I have two SQL-ORACLE question,
>
>1)How to write SQL statements that will fetch a certain field
> of the "last record in the table". Say table A which contains
> field named Dept. I realized before this in this newsgroup there is
> a way to get the "last 15" using rownum < 16. However how if I
> don't know how many records in the table but I just want to get
> the last one.

Reverse your ORDER BY clause from ASC to DESC (or visa-versa) and retrieve the first record (rownum = 1).

Cheers...David Received on Wed Oct 07 1998 - 16:14:26 CEST

Original text of this message