Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Oracle 9i Master Detail Pagination

Oracle 9i Master Detail Pagination

Scheduled Pinned Locked Moved Database
databaseoraclehelp
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    K P Kannan
    wrote on last edited by
    #1

    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

    H 1 Reply Last reply
    0
    • K K P Kannan

      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

      H Offline
      H Offline
      Harini N K
      wrote on last edited by
      #2

      Hi I am not getting you .. explain clearly how you want output from the result

      Harini

      K 2 Replies Last reply
      0
      • H Harini N K

        Hi I am not getting you .. explain clearly how you want output from the result

        Harini

        K Offline
        K Offline
        K P Kannan
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • H Harini N K

          Hi I am not getting you .. explain clearly how you want output from the result

          Harini

          K Offline
          K Offline
          K P Kannan
          wrote on last edited by
          #4

          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

          H 2 Replies Last reply
          0
          • K K P Kannan

            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

            H Offline
            H Offline
            Harini N K
            wrote on last edited by
            #5

            Hi I will try out your in SQL Server 2000 and let you know as Oracle is not installed on my machine.

            Harini

            1 Reply Last reply
            0
            • K K P Kannan

              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

              H Offline
              H Offline
              Harini N K
              wrote on last edited by
              #6

              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

              K 1 Reply Last reply
              0
              • H Harini N K

                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

                K Offline
                K Offline
                K P Kannan
                wrote on last edited by
                #7

                Thank You Harini. I am trying to convert this into Oracle. There are some problems. I will let you know once done

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups