Subject | RE: [firebird-support] FIRST m SKIP n problem |
---|---|
Author | Leyne, Sean |
Post date | 2003-11-02T18:33:17Z |
Yves,
CREATE PROCEDURE GET_LAST_4_ENTRIES
(
EmployeeName VarCHAR( 80)
)
RETURNS
(
datetime date,
blabla bla
)
AS
BEGIN
For
SELECT FIRST 4
:datetime
:blabla
FROM <table> T
WHERE
Name = :EmployeeName
Order By
Datetime desc
Into
:datetime
:blabla
Do
Begin
Suspend;
end
END;
Step 2 - Use SP as virtual table
SELECT
*
From
GET_LAST_4_ENTRIES( {EmployeeName})
Order by
Datetime
Sean
> I want to retrieve the last 4 things joe has done, ordered byStep 1 -- Create select SP
> datetime (asc).
>
> So using FIRST 4 and use 'desc' order is not ok... :-(
>
> How can I do that (using FB1.03)?
CREATE PROCEDURE GET_LAST_4_ENTRIES
(
EmployeeName VarCHAR( 80)
)
RETURNS
(
datetime date,
blabla bla
)
AS
BEGIN
For
SELECT FIRST 4
:datetime
:blabla
FROM <table> T
WHERE
Name = :EmployeeName
Order By
Datetime desc
Into
:datetime
:blabla
Do
Begin
Suspend;
end
END;
Step 2 - Use SP as virtual table
SELECT
*
From
GET_LAST_4_ENTRIES( {EmployeeName})
Order by
Datetime
Sean