Subject | Re: Select Query Optimization question |
---|---|
Author | Doychin |
Post date | 2010-09-05T05:19Z |
If you want to sort the first 20 records only you should surround your query with another select and apply the order by to the external query.
This way Firebird will select first 20 records using natural order and then will order them by JOB_ID.
select JOB_ID, CLIENT_NAME, SITE_DESC, ENTERED_TS, JS_NAME,
CT_NAME, JOB_DESC_SHORT, CLIENT_ID, TECH_ALLOC_DISPLAY,
HAS_WIP, ICON_URL
from (here comes your select) primary_select
order by JOB_ID
Doychin Bondzhev
This way Firebird will select first 20 records using natural order and then will order them by JOB_ID.
select JOB_ID, CLIENT_NAME, SITE_DESC, ENTERED_TS, JS_NAME,
CT_NAME, JOB_DESC_SHORT, CLIENT_ID, TECH_ALLOC_DISPLAY,
HAS_WIP, ICON_URL
from (here comes your select) primary_select
order by JOB_ID
Doychin Bondzhev