Subject Re: [firebird-support] First and Last
Author Nick Upson
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
-----We Solve your Computer Problems---
Founder & Listowner of the Prolifics User Group
Panther, Ingres, UNIX, Interbase, Firebird - Available Shortly