开发者

Oracle/SQL - Split list into 3 segments

开发者 https://www.devze.com 2023-03-13 09:22 出处:网络
I\'m wondering how I would go about writing a query to split a table into 3 segments.When I\'v开发者_如何学JAVAe had to split a table into 2 before I\'ve always based it off the rownum and doing a mod

I'm wondering how I would go about writing a query to split a table into 3 segments. When I'v开发者_如何学JAVAe had to split a table into 2 before I've always based it off the rownum and doing a mod on it. I know I could again use rownum and select based on ranges, but if the list varies in record count each time the queries are run they will have to be updated.

Any thoughts?


Why can't you continue to use MOD, as in MOD(rownum, 3) = 0, 1 or 2? If it worked for 2, why not 3?

0

精彩评论

暂无评论...
验证码 换一张
取 消