Path: utzoo!attcan!uunet!cs.utexas.edu!swrinde!ucsd!ucbvax!ucdavis!csusac!unify!nico From: nico@unify.uucp (Nico Nierenberg) Newsgroups: comp.databases Subject: Re: Simple SQL question Keywords: SQL Message-ID: <1989Nov21.173541.25422@unify.uucp> Date: 21 Nov 89 17:35:41 GMT References: <98813@ti-csl.csc.ti.com> <1989Nov19.200834.266@mrspoc.Transact.COM> <1217@hpuviea.UUCP> Reply-To: nico@unify.UUCP (Nico Nierenberg) Organization: Unify Corporation, Sacramento, CA, USA Lines: 24 In article <1217@hpuviea.UUCP> gernot@hpuviea.UUCP (Gernot Kunz) writes: > >Oops, what a tricky UNIX hack to circumvent an obviously >missing SQL functionality. In ORACLE you could do THIS: > > create table temptable(name ..., birthdate ...); > > insert into temptable > select name, birthdate > from employee > order by birthdate desc; > > select name,birthdate > from temptable > where rownum <= 10 ; > >and remain in pure SQL. It requires a temporary table, though. > You have got to be kidding to call this "pure" SQL. You are relying on an artifact of the Oracle system that the rownum can be reliably counted on in a new table. I actually think that this is less desirable than Steven's original idea. If you don't like the Unix flavor then use some other filter or embedded SQL.