Oracle 9i Master Detail Pagination
-
I am using two different tables products and product details . Product ID is the primary key of the products table and is the foreign key reference to the Product details table. I want to fetch only five 5 records from the products table and for each productID I need two records from the product details table. It will be like M1 C11 M1 C12 M2 C21 M2 C22 I am using oracle 9i database. Please help
-
I am using two different tables products and product details . Product ID is the primary key of the products table and is the foreign key reference to the Product details table. I want to fetch only five 5 records from the products table and for each productID I need two records from the product details table. It will be like M1 C11 M1 C12 M2 C21 M2 C22 I am using oracle 9i database. Please help
Hi I am not getting you .. explain clearly how you want output from the result
Harini
-
Hi I am not getting you .. explain clearly how you want output from the result
Harini
We have two tables One containing the list of products p1,p2,p3,p4,p5 other any contents associated with the products p1,c1 p1,c2 p1,c3 p2,c4 p2,c5 p2,c6 p3,c7 p4,c8 p4,c9 p4,c10 I would like to get the below resultset p1,c1 p1,c2 p2,c4 p2,c5 p3,c7 p4,c8 p4,c9 Basically master detail for data binding. My situation is that I need to some x records, let's say 5 products and on pagination next 5 products as a master and 2 contents(at the maximum) within each products, (if one content show only one) and view all button within that(.NET) to show the remaining contents for that product. It's a master detail grid. I want to retrive that kind of resultset from the query Thanks, K.P.Kannan
-
Hi I am not getting you .. explain clearly how you want output from the result
Harini
CREATE TABLE t1(col1 NUMBER) CREATE TABLE t2(col1 NUMBER,col2 NUMBER) INSERT INTO t1 VALUES(1);INSERT INTO t1 VALUES(2);INSERT INTO t1 VALUES(3); INSERT INTO t1 VALUES(4);INSERT INTO t1 VALUES(5);INSERT INTO t1 VALUES(6); INSERT INTO t2 VALUES(1,1);INSERT INTO t2 VALUES(2,1);INSERT INTO t2 VALUES(3,1);INSERT INTO t2 VALUES(4,1);INSERT INTO t2 VALUES(5,1);INSERT INTO t2 VALUES(6,1);INSERT INTO t2 VALUES(1,2);INSERT INTO t2 VALUES(3,2);INSERT INTO t2 VALUES(4,2);INSERT INTO t2 VALUES(6,2);INSERT INTO t2 VALUES(1,3); INSERT INTO t2 VALUES(3,3);INSERT INTO t2 VALUES(6,3); SELECT col1, col2 FROM t2 d WHERE col1 IN (SELECT col1 FROM (SELECT ROWNUM AS rownumber1,col1,col2 FROM t2 WHERE col1 IN (SELECT col1 FROM (SELECT ROWNUM AS rownumber,col1 FROM t1) WHERE rownumber<=3)--WHERE c.col1=col1 )WHERE rownumber1<=2 AND d.col1=col1) I want a query which will produce the following result.I just tried with the above one which is failing(no result or not compiling). 1 1 1 2 2 1 3 1 3 2
-
CREATE TABLE t1(col1 NUMBER) CREATE TABLE t2(col1 NUMBER,col2 NUMBER) INSERT INTO t1 VALUES(1);INSERT INTO t1 VALUES(2);INSERT INTO t1 VALUES(3); INSERT INTO t1 VALUES(4);INSERT INTO t1 VALUES(5);INSERT INTO t1 VALUES(6); INSERT INTO t2 VALUES(1,1);INSERT INTO t2 VALUES(2,1);INSERT INTO t2 VALUES(3,1);INSERT INTO t2 VALUES(4,1);INSERT INTO t2 VALUES(5,1);INSERT INTO t2 VALUES(6,1);INSERT INTO t2 VALUES(1,2);INSERT INTO t2 VALUES(3,2);INSERT INTO t2 VALUES(4,2);INSERT INTO t2 VALUES(6,2);INSERT INTO t2 VALUES(1,3); INSERT INTO t2 VALUES(3,3);INSERT INTO t2 VALUES(6,3); SELECT col1, col2 FROM t2 d WHERE col1 IN (SELECT col1 FROM (SELECT ROWNUM AS rownumber1,col1,col2 FROM t2 WHERE col1 IN (SELECT col1 FROM (SELECT ROWNUM AS rownumber,col1 FROM t1) WHERE rownumber<=3)--WHERE c.col1=col1 )WHERE rownumber1<=2 AND d.col1=col1) I want a query which will produce the following result.I just tried with the above one which is failing(no result or not compiling). 1 1 1 2 2 1 3 1 3 2
Hi I will try out your in SQL Server 2000 and let you know as Oracle is not installed on my machine.
Harini
-
CREATE TABLE t1(col1 NUMBER) CREATE TABLE t2(col1 NUMBER,col2 NUMBER) INSERT INTO t1 VALUES(1);INSERT INTO t1 VALUES(2);INSERT INTO t1 VALUES(3); INSERT INTO t1 VALUES(4);INSERT INTO t1 VALUES(5);INSERT INTO t1 VALUES(6); INSERT INTO t2 VALUES(1,1);INSERT INTO t2 VALUES(2,1);INSERT INTO t2 VALUES(3,1);INSERT INTO t2 VALUES(4,1);INSERT INTO t2 VALUES(5,1);INSERT INTO t2 VALUES(6,1);INSERT INTO t2 VALUES(1,2);INSERT INTO t2 VALUES(3,2);INSERT INTO t2 VALUES(4,2);INSERT INTO t2 VALUES(6,2);INSERT INTO t2 VALUES(1,3); INSERT INTO t2 VALUES(3,3);INSERT INTO t2 VALUES(6,3); SELECT col1, col2 FROM t2 d WHERE col1 IN (SELECT col1 FROM (SELECT ROWNUM AS rownumber1,col1,col2 FROM t2 WHERE col1 IN (SELECT col1 FROM (SELECT ROWNUM AS rownumber,col1 FROM t1) WHERE rownumber<=3)--WHERE c.col1=col1 )WHERE rownumber1<=2 AND d.col1=col1) I want a query which will produce the following result.I just tried with the above one which is failing(no result or not compiling). 1 1 1 2 2 1 3 1 3 2
Hi I tried out this query in SQL Server 2000. It is working as expected and I am not sure whether this will work in Oracle select t2.col1, t2.col2 from t2 inner join t1 on t1.col1 = t2.col2 and t2.col1 in (select top 2 a.col1 from t2 a where a.col2 = t1.col1 order by a.col1) :)
Harini
-
Hi I tried out this query in SQL Server 2000. It is working as expected and I am not sure whether this will work in Oracle select t2.col1, t2.col2 from t2 inner join t1 on t1.col1 = t2.col2 and t2.col1 in (select top 2 a.col1 from t2 a where a.col2 = t1.col1 order by a.col1) :)
Harini
Thank You Harini. I am trying to convert this into Oracle. There are some problems. I will let you know once done