How to resolve many-to-many join by 2 one-to-many joins

Hi,
   I was asked many times how to resolve many to many relationship between two tables. I read to use 2 one -to- many relationships to resolve this. Can some expalin me when many to many relationship occurs between two tables and how to reslove them with practicle examples. Is there any article on this?
Regards,
Nanda Kishore

Hi,
Please check below link.
http://www.forumtopics.com/busobj/viewtopic.php?p=859029&sid=20d79e3df07b0d8b41aadfbd902bb6b2
http://blog.oaktonsoftware.com/2011/04/bridge-tables-and-many-to-many.html
Thanks,
Amit

Similar Messages

  • How can I export a list of events for one of many calendars - e.g. "sailing" to use in Excel

    How can I export a list of events for one of many calendars - e.g. "sailing" to use in Excel?

    See this thread here
    Display number of emails by sender

  • Joining Tables Involving "one to many"

    I have a situation where a customer gets a basic "license" to perform a business then he or she may get multiple "permits" to perform sub tasks of the basic business plan.
    I must join the "license" table with the "permits" table. I have currently joined them with a license identification number that appears in both tables, without qualification as to "one to one" or "outer join".
    There is always a license ID number in the licensing table.
    There may be multiple occurrance's of the license ID number in the permits table.
    Should I qualify the join?

    Thank you for the rapid response. I am returning to the Discoverer product after a long absence and need brushing up on many standard concepts.
    In a recent response to a question on joins by another requestor, the forum respondent advised that "you didn't include the join in a condition i.e. master table item x is equal to detail table item x". Isn't it a redundancy to put the join in a condition if a joins already exists for the detail table information. I know that I can trick the CBO into more rapid response by including redundant conditions in the query such as a date range that includes all the records in a table. A test demonstrated that the inclusion of the join in the condition caused the data to literally explode on the screen.

  • Join 2 tables, One to many, but single row only

    I have a table (actually it is a view) with detail information.
    I want to join to that table, but for my join criteria, bring back no more than 1 row. This is because there is some data on the table which is consisitent on each row so any row of my join will do.
    ie.
    select list.invoice_number, inv.payment_terms
    from
    list, inv
    where list.invoice_number=inv.invoice_number(+)
    LIST
    Invoice Number
    1
    2
    3
    4
    INV
    Invoice Number, Seq, Payment_terms
    1               1    30
    1               2    30
    1               3    30
    2               1    40
    2               2    40
    3               1    50would produce
    Invoice Number, Payment_terms
    1               30
    2               40
    3               50
    4Thanks

    Would there be more than one value for payment_terms in inv? If so, then the distinct is probably the way to go, although I would probably do the DISTINCT in an in-line view like:
    SELECT list.invoice_number, inv.payment_terms
    FROM list,
         (SELECT DISTINCT invoice_number, payment_terms
          FROM inv) inv
    WHERE list.invoice_number=inv.invoice_number(+)If each invoice would only ever have one value for payment_terms, then I might try an in-line view like:
    SELECT list.invoice_number, inv.payment_terms
    FROM list,
         (SELECT invoice_number, MAX(payment_terms) payment_terms
          FROM inv
          GROUP BY invoice_number) inv
    WHERE list.invoice_number=inv.invoice_number(+)On the other hand, if inv is a view based on a multitable join, I would also check to see if incoice_number and payment_terms come from the same table. If so, I would be tempted to write your query using the base tables instead of the view since it is likely to bve more efficient.
    John

  • Workbench-Cannot Give Joining to One-To-Many

    Hi there,
    i am using toplink workbech 10g release 2(10.1.3.0DP4) build 050715. In workbench, i want to put "use joining" to a one-to-many relationship. Joining can be applied to one-to-many relationships from the java code but in workbench i cannot give joining to the one-to-many relationships. There is no checkbox for that property. I can only check batch reading. Is it true, or is there a problem with my mapping workbench?

    This is true, there is currently no 1-m joining support in the Mapping Workbench, nor can you set this at the mapping level in the code API. 1-m joining can only currently be set at the query level in the code API. Note that in general batch reading for 1-m is more performant than joining, so you may want to consider using it instead.

  • How to implement one to many relationship between two Document Line Table

    Hi,
    I want to implement the following relationship into user defined tables:
    Example Situation:
    There are tables A, B and C.
    For one record of Table A, there could be multiple records in table B.
    For one record of Table B, there could be multiple records in table C.
    i.e. A(1) -> B(n) [One to many relationship]
         B(1) -> C(n) [One to many relationship]
    finally: A(1) -> B(n) -> C(n)
    How can I achieve this? If I make Table A as Document and table B & C as Document Line and then make them UDO, will it work? Kindly suggest me a solution.
    Regards,
    Sudeshna.

    Hi,
    I think that the database representation is exactly what you ask for. 3 tables, A, B, C. A should have a UDF that is linked to B table, and B should have a UDF that is linked to C table.
    You should manage the database transactions, and the UI to support all this stuff.
    Regards,
    IBai Peñ

  • One to many mappings delete problem

    in using Toplink 9.0.3, I have modeled a simple one to many relationships and have ran into errors on deletion.
    The following is an object model that fails to delete
    diagram has one to many companies ( privately held )
    companies have one to many ownerships ( privately held )
    ownerships have a one to one to an owner company and an owned company ( not privately held ).
    In the simplest scenario, Toplink knows how to delete a diagram. It will delete an ownership, then delete the companies and then delete the diagram.
    However in a diagram where a company owns two companies, Toplink fails. It attempts to delete an owned company before deleting the parent Ownership.
    Note that if toplink deleted the owner company then, it would know to delete the many ownerships first.
    How do we tell toplink that on deleting a company,
    1. delete all the ownerships in its one to many
    2. and delete all the ownerships in which the company
    plays the role as an owned company.
    Note that deleting an ownership should not trigger a deletion of either the owner company or the owned company.
    please contact at [email protected]

    Hello,
    You appear to be missing a mapping in your object model.
    TopLink decides its commit order, for both insertions and deletions based on the ONE TO ONE mappings in a project.
    It appears that your company has no ONE TO ONE mapping to the diagram, which means that TopLink MAY decide to delete diagrams before it deletes companies.
    I would suggest that you try adding a one to one mapping from company to diagram, correctly populated, and see if the problem recurs.
    I hope this is of some help,
    Christian

  • One to Many relationship in CMP

    Hi,
    How to create CMP entity bean that can map One To Many relationship?
    Thanks.
    (Actually, i have post this question in "Java programming" forum becoz i couldn't find the EJB link in forum main page...)

    Hello Friend,
    Go carefully through the RosterApp example in the J2EE tutorial.
    It sure is going to help you.
    See each and every tab and the values in the deployment tool.
    Best of Luck

  • Simple one to many mapping question

    Hi,
    In the Toplink tutorial there is a one to many relation between Employee and PhoneNumber, and one to one between PhoneNumber and Employee.
    If I don't require can I eliminate the one to one relationship between PhoneNumber and Employee. Or Toplink requires it?
    Thanks
    -Mani

    Hi,
    The purpose of creating one-to-one back reference mapping in the target is so that the foreign key information can be written when the target object is saved. Alternatives to the one-to-one mapping back reference include:
    Use a direct-to-field mapping to map the foreign key and maintain its value in the application. Here the object model does not require a back reference, but the data model still requires a foreign key in the target table.
    Use a many-to-many mapping to implement a logical one-to-many. This has the advantage of not requiring a back reference in the object model and not requiring a foreign key in the data model. In this model the many-to-many relation table stores the collection. It is possible to put a constraint on the join table to enforce that the relation is a logical one-to-many relationship.
    Raanan.

  • I downloaded a movie to my Air, but it won't sync to my ipad2 and says it's not authorized.  It's not a rental.  Anyone else have this problem or know how to resolve?

    I downloaded a movie to my Air, but it won't sync to my ipad2 and says it's not authorized.  It's not a rental.  Anyone else have this problem or know how to resolve?

    I ended up having a one hour conversation with Apple Support which evolved to handing over control of my screen and then eventually having to use Terminal.  I wish I could remember the command but it's probably best I don't. 
    One thing we looked at right away was the account name used to dowload the movie.  Is it the same as the account name  you have saved on your iPad.  That's easy to check and would be great if that is all that's needed to correct.  Good luck.
    Here's also an email I got from Support that could solve your problem if it's not as difficult as my issue was.
    I would like to inform you that this issue can occur if iOS (your device's operating system) on your device needs to be updated. It can also happen if the computer you're trying to sync from has not been authorized to play purchases you are trying to sync.
    I suggest that you first see if updating iOS on your iPad resolves the issue. This article will walk you through the process:
    Backing up, updating, and restoring your iPhone, iPad, or iPod touch software
    http://support.apple.com/kb/HT1414
    If there are still purchases that won't sync to your device after you update its software, I suggest reauthorizing your computer. To do so, follow these steps:
    1) Open iTunes.
    2) From the Store pull-down menu at the top, choose Deauthorize Computer.
    3) Enter your account name and password, then click Deauthorize.
    4) Now from the Store pull-down menu at the top, choose Authorize Computer.
    5) Enter your account name and password, then click Authorize.
    Once your computer has been authorized, try syncing your device again. If the same issue happens, I suggest reviewing the following articles:
    Some songs in iTunes won't copy to iPod
    http://support.apple.com/kb/TS1420
    iTunes: May be unable to transfer videos to iPhone, iPad, or iPod
    http://support.apple.com/kb/TS1497
    Syncing iPad, iPhone, or iPod touch with iTunes
    http://support.apple.com/kb/HT1386
    iOS: How to transfer or sync content to your computer
    http://support.apple.com/kb/HT1296
    You'll also find a wide variety of helpful iPad troubleshooting tips, tutorials, and service information on this page:
    http://www.apple.com/support/ipad

  • Two tables that have both "many-to-many" and "one-to-many" relationship

    i have the following two tables one represents the users and the other represents articles where each article can have one author(user) and of course the users can author many articles, so the relationship is one-to-many:-
    1. Users:-
    User_id (primary_key)
    User_name
    User_sex
    user_address
    2.Articiles:-
    Article_id
    Text
    Author_id (foreign key to the users.user_id)
    but the problem that i have faced is that on another requirement each articles can have multiple approval (users) before being published, so in this way the relation have became many-to-many, so i have created a third table named "approvals":-
    3.Approval:-
    approval_id (foreign key to the users.user_id)
    article_id (foreign key to the articles.article_id)
    level.
    so is this a good approach to flow , or there are another way that i can better build these tables.

    sb92075 wrote:
    approval_id (foreign key to the users.user_id) I am not clear on data element above.
    I thought USERS were really AUTHORS. yes the authors are users , and the author id is exactly the same as user id.
    and any user can be author if a flag in the users table is set to yes and he is involved in a workflow.
    so do authors approve their own articles? no
    do non-authors approve articles?
    What is "level" in APPROVAL table?
    What is PK for APPROVAL table? level indicates the workflow steps if there are multiple steps in the workflow ,for example the first approval is on level one, and the second approval is on level two,etc
    the primary key for the approval will be article_id and the user_id

  • How to resolve many fact tables and Dimensions tables

    Hi,
    The scenario is we have many facts and dimension tables. Based on some conditions one measure from one fact will be divided by another fact measure. I have encoutered with many errors like " Unable to navigate .... " ? How to resolve these errors and reduce many to few ? ( I assume creating logical tables, but is there any other alternatives ? )
    thanks
    Suresh

    Suresh,
    I assume that you know how to create a single logical fact from n-physical facts, ie only if the fact tables are related. Then join all the conformed dimensions to this single Logical table using a join in the Business Model layer. Remember to set the mappings in the LTS. All if you have any hierarchies please set the aggregation level for those.
    - Red

  • My wife and I have made many purchases over several years on seperate accounts, how could we join them into one account, without losing everything?

    My wife and I have made many purchases over several years on seperate accounts, how could we join them into one account, without losing everything? We both use Iphone 5's and share an Imac at home.

    Purchases using one Apple ID cannot be merged or transferred to another Apple ID. Purchases are forever tied to that Apple ID used. You have to decide which Apple you want to use for purchases and stick to that Apple ID so that you can share: Settings > iTunes & App Stores > Apple ID : > use the same Apple ID here to share purchases.

  • How just return one row of a one to many join..

    So I have a one to many join where the SMOPERATOR table has data I need however it has a couple of rows that match the JOIN condition in there. I just need to return one row. I think this can be accomplished with a subquery in the join however have not been able to come up with the right syntax to do so.
    So:
    SELECT "NUMBER" as danumber,
    NAME,
    SMINCREQ.ASSIGNMENT,
    SMOPERATOR.PRIMARY_ASSIGNMENT_GROUP,
    SMOPERATOR.WDMANAGERNAME,
    SMINCREQ.owner_manager_name,
    SMINCREQ.subcategory, TO_DATE('01-'||TO_CHAR(open_time,'MM-YYYY'),'DD-MM-YYYY')MONTHSORT,
    (CASE WHEN bc_request='f' THEN 'IAIO'
    WHEN (bc_request='t' and substr(assignment,1,3)<>'MTS') THEN 'RARO'
    WHEN (bc_request='t' and substr(assignment,1,3)='MTS') THEN 'M'
    ELSE 'U' end) as type
    from SMINCREQ
    left outer join SMOPERATOR on SMINCREQ.assignment=SMOPERATOR.primary_assignment_group
    WHERE SMINCREQ.owner_manager_name=:P170_SELECTION and SMOPERATOR.wdmanagername=:P170_SELECTION
    AND open_time BETWEEN to_date(:P170_SDATEB,'DD-MON-YYYY') AND to_date(:P170_EDATEB,'DD-MON-YYYY')
    AND
    (bc_request='f' and subcategory='ACTIVATION' and related_record<>'t')
    OR
    (bc_request='f' and subcategory<>'ACTIVATION')
    OR
    (bc_request='t' and substr(assignment,1,3)<>'MTS')
    order by OPEN_TIMe

    Hi,
    This sounds like a Top-N Query , where you pick N items (N=1 in this case) off the top of an orderded list. I think you want a separate ordered list for each assignment; the analytic ROW_NUMBER function does that easily.
    Since you didn't post CREATE TABLE and INSERT statements for your sample data, I'll use tables from the scott schema to show how this is done.
    Say you have a query like this:
    SELECT       d.dname
    ,       e.empno, e.ename, e.job, e.sal
    FROM       scott.dept  d
    JOIN       scott.emp   e  ON   d.deptno = e.deptno
    ORDER BY  dname
    ;which produces this output:
    DNAME               EMPNO ENAME      JOB              SAL
    ACCOUNTING           7934 MILLER     CLERK           1300
    ACCOUNTING           7839 KING       PRESIDENT       5000
    ACCOUNTING           7782 CLARK      MANAGER         2450
    RESEARCH             7876 ADAMS      CLERK           1100
    RESEARCH             7902 FORD       ANALYST         3000
    RESEARCH             7566 JONES      MANAGER         2975
    RESEARCH             7369 SMITH      CLERK            800
    RESEARCH             7788 SCOTT      ANALYST         3000
    SALES                7521 WARD       SALESMAN        1250
    SALES                7844 TURNER     SALESMAN        1500
    SALES                7499 ALLEN      SALESMAN        1600
    SALES                7900 JAMES      CLERK            950
    SALES                7698 BLAKE      MANAGER         2850
    SALES                7654 MARTIN     SALESMAN        1250Now say you want to change the query so that it only returns one row per department, like this:
    DNAME               EMPNO ENAME      JOB              SAL
    ACCOUNTING           7782 CLARK      MANAGER         2450
    RESEARCH             7876 ADAMS      CLERK           1100
    SALES                7499 ALLEN      SALESMAN        1600where the empno, ename, job and sal columns on each row of output are all taken from the same row of scott.emp, though it doesn't really matter which row that is.
    One way to do it is to use the analytic ROW_NUMBER function to assign a sequence of unique numbers (1, 2, 3, ...) to all the rows in each department. Since each sequence startw with 1, and the numbers are unique within a department, there will be exactly one row per departement that was assigned the numebr 1, and we''ll display that row.
    Here's how to code that:
    WITH     got_r_num     AS
         SELECT     d.dname
         ,     e.empno, e.ename, e.job, e.sal
         ,     ROW_NUMBER () OVER ( PARTITION BY  d.dname
                                   ORDER BY          e.ename
                           )         AS r_num
         FROM     scott.dept  d
         JOIN     scott.emp   e  ON   d.deptno = e.deptno
    SELECT       dname
    ,       empno, ename, job, sal
    FROM       got_r_num
    WHERE       r_num     = 1
    ORDER BY  dname
    ;Notice that he sub-query got_r_num is almost the same as the original query; only it has one additional column, r_num, in the SELECT clause, and the sub-qeury does not have an ORDER BY clause. (Sub-queries almost never have an ORDER BY clause.)
    The ROW_NUMBER function must have an ORDER BY clause. In this example, I used "ORDER BY ename", meaning that, within each department, the row with the first ename (in sort order) will get r_num=1. You can use any column, or expression, or expressions in the ORDER BY clause. You muight as well use something consistent and predictable, like ename, but if you really wanted arbitrary numbering you could use a constant in the analytic ORDER BY clause, e.g. "ORDER BY NULL".

  • Error saying "this ID has been authorised too many times" , how to resolve ASAP?

    Error saying "this ID has been authorised too many times" , how to resolve ASAP?

    Adobe Live Chat: http://www.adobe.com/support/chat/ivrchat.html
    They can reset your authorizations, and then you must reauthorize any devices you still need.
    (Unfortunately, Adobe haven’t got round to an admin website for viewing and editing authorizations.)
    Some of the representatives haven't been properly trained and don't know what to do (and claim there is nothing they can do);
    in that case the only way seems to be to give up that chat and try another session hoping for a properly trained representative.
    If your problem is with another device using Overdrive, Bluefire, Aldiko or similar third party app, it is recommended not to mention that app when on the chat, just mention that you have run out of authorizations  (E_ACT_TOO_MANY_ACTIVATIONS) .  Thanks to AJP_Bear for that tip.

Maybe you are looking for

  • Printing settings not holding in firefox

    When printing a document from Amazon my Canon Laser D480 wants to print in landscape mode even when I set the parameters in windows to Portrait Mode setting. Printing a MS Word document works properly. Is Amazon sending false printer settings????? ==

  • Double side business card crop marks

    Hi I am working on double sided business cards. I am using illustrator cs4.  But the crop marks on one side dont align with the other. I am also using a office jet pro 8600 with duplex printing. I called HP but they said it has nothing to with the pr

  • Colour picker not sampling right colour - colour management?

    Hi there, so i have an image i painted in RGB in photoshop and saved it out as jpeg. Placed it into a RGB document in illustrator. All my colour settings are synced for rgb to be sRGB. I sampled the colour straight off the placed image (and theres no

  • Copy in Finder is very slow

    Hi, I use OS X 10.8.2 here and file copy from a disc image to finder is very slow. i can find this in console: 21.09.12 16:31:45,283 DiskImages UI Agent[1207]: *** -[NSMachPort handlePortMessage:]: dropping incoming DO message because the connection

  • Document will no open, pages shuts down

    When I tap a particular document I want to open, the screen flashes back to home screen. How can I get the info on the document?  This happened after I imported a photo from my photos located on the iPad.  I don't need the photo, just the document.