getting correct number of rownumber for many to one table?
getting correct number of rownumber for many to one table?
![totaljj](https://secure.gravatar.com/avatar/d7e5b885622260b7b55804f247ad0d7f/?default=https%3A%2F%2Fvanillicon.com%2Fd7e5b885622260b7b55804f247ad0d7f_200.png&rating=g&size=120)
I have many to one relationship between two tables in Oracle(USER, GROUP).
If group1 has two users and group2 has one user, I would get thress records running below query.
SELECT * FROM (
SELECT ROWNUM RNUM, OQ.*
FROM (select g.*, u.* from group g left join user u on g.id= u.group_id) OQ)
WHERE RNUM BETWEEN #{start_index} AND #{end_index}
I need to have start_index 0 and end_index 3 because I want to have group1 only.
If group1 has three USERS I need to have end_index 4.
Does anyone know how to calculate end_index depending on the data on many table?
This discussion has been closed.