Subject | Re: [firebird-support] First and Last |
---|---|
Author | DataCom - Diego |
Post date | 2004-05-07T21:10:52Z |
sorry for the silly question, but are stored procedures portable to other
databases? If not, wouldnt it be better to find a "SQL-standard" solution?
DIEGO Moreira da Rosa
DataCom Telemática
databases? If not, wouldnt it be better to find a "SQL-standard" solution?
DIEGO Moreira da Rosa
DataCom Telemática
----- Original Message -----
From: "Nick Upson" <nick@...>
To: <firebird-support@yahoogroups.com>
Sent: Friday, May 07, 2004 5:07 PM
Subject: Re: [firebird-support] First and Last
> How about something like
>
> CREATE PROCEDURE proc1 ()
> returns (fielda int)
> AS
> begin
> SELECT FIRST 10 fielda FROM Mytable INTO :fielda ORDER BY 1 ASC
> DO
> BEGIN
> SUSPEND;
> END
> SELECT LAST 10 fielda FROM Mytable INTO :fielda ORDER BY 1 ASC
> DO
> BEGIN
> SUSPEND;
> END
> end
>
> called by:
>
> select fielda from proc1;
>
> In article <c7gncp+domg@...>, Gorepj wrote:
> > SELECT FIRST 10 * FROM Mytable ORDER BY 1 ASC
> > UNION
> > SELECT FIRST 10 * FROM Mytable ORDER BY 1 DESC
> >
> > This doesn't work because you can't have two order by clauses in
> > the same query. So is there alternative way?
> >
>
> --
> Nick