Subject | Select first 3 and last 3 records |
---|---|
Author | Cao Ancoinc |
Post date | 2005-06-09T06:23:18Z |
Hi all
I need to select the first 3 and last 3 records from a transaction file
This I would imagine would be a simple query as the example below however
Firebird objects to the "order by" clause when a "union" operator is present
select first 3 PrnId, InvNo
from Ordtrn
where PrnId='21'
order by InvNo
union
select first 3 PrnId, InvNo
from Ordtrn
where PrnId='21'
order by InvNo desc
Any suggestions on how to work around the problem
Regards Cao
I need to select the first 3 and last 3 records from a transaction file
This I would imagine would be a simple query as the example below however
Firebird objects to the "order by" clause when a "union" operator is present
select first 3 PrnId, InvNo
from Ordtrn
where PrnId='21'
order by InvNo
union
select first 3 PrnId, InvNo
from Ordtrn
where PrnId='21'
order by InvNo desc
Any suggestions on how to work around the problem
Regards Cao