> In MS SQL and Access, there is the TOP clause to limit the
> number of records, but I'm not sure if and how you can set
> the first one.

SELECT BOTTOM 50 * FROM mytable
WHERE mytable_id IN
        (SELECT TOP 100 mytable_id FROM mytable
        ORDER BY my, column, list)
ORDER BY my, column, list

The order by clause must be the same in both the outer and sub-query.

> In Oracle, there is ROWNUM...

Yeah, but that's not how you get a set out of the middle with Oracle,
'cause if you specify a minimum value for rownum you don't get the
expected results... well... not by itself... In oracle you use the
MINUS clause, which is surprisingly efficient... but... I still don't
recommend using it, just because I advocate db independance.

SELECT * FROM mytable WHERE rownum < 100
ORDER BY my, column, list

MINUS SELECT * FROM mytable WHERE rownum > 50
ORDER BY my, column, list

.... I haven't used this recently, so I'm not certain the order by
clauses are in the right place, but that's the gist of it.


s. isaac dealey   954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216894
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to