Subject | Problem with FIRST in where clause |
---|---|
Author | Christian Kaufmann |
Post date | 2006-08-31T09:35:28Z |
The following query should find the last 50 meets, that where recently
changed and should sort the result by the date of the meet:
select * from MEET
where MEETID in (select first 50 MEETID from MEET order by LASTCHANGED
desc)
order by ENDDATE
When I run this query, I get all records of my table MEET. Can
somebody tell me, what goes wrong?
Also the plan is not perfect:
PLAN (MEET ORDER IX_MEET_LASTCHANGED)
PLAN (MEET NATURAL)
IX_MEET_LASTCHANGED is a descending index on LASTCHANGED
cu Christian
changed and should sort the result by the date of the meet:
select * from MEET
where MEETID in (select first 50 MEETID from MEET order by LASTCHANGED
desc)
order by ENDDATE
When I run this query, I get all records of my table MEET. Can
somebody tell me, what goes wrong?
Also the plan is not perfect:
PLAN (MEET ORDER IX_MEET_LASTCHANGED)
PLAN (MEET NATURAL)
IX_MEET_LASTCHANGED is a descending index on LASTCHANGED
cu Christian