Re: Select a specified number items from a table
Posted in 1996
Charley Chen wrote:
>
> Hi,
>
> I'm having a problem trying to select only a certain number of rows from
> a table. For example I want select the 5 most recent currency exchange
> rates for the canadian dollar. If anyone have any suggestion or need
> further information please email me. Thank you very much.
>
> Charley
>
> Email: cchen@transre.com
My Idea is to select the expected columns into a temporary table
which is extended for a serial column .
This Solution requires "only" sql
:
drop table bla;
create temp table bla
(x serial,
e char(13));
insert into bla (e)
select e from source_table ;
select e from bla
where x <= 5
--
+++++++++++++++++++++++++++++++++
------------------------------------
greetings from Christoph Schiffer \\ / Voice : +49 2104 9385-18
chris@csl-gmbh.net o FAX : +49 2104 9385-55
CSL-GmbH Erkrath / \\ http://www.csl-gmbh.net
---------------------------------
++++++++++++++++++++++++++++++++++++