Results 1 to 4 of 4
  1. #1
    udigold1 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2010
    Posts
    29

    Join Query from 4 tables

    Hi,
    I'm pretty n00b in complicated SQL statements, so I apologize in advance.
    I have 4 tables:
    1. table of balance sheet of equities.
    2. table of tradable equities (from an outside source)
    3. table of non-tradable equities (managed in the database)
    4. table of corporate entities for both tradable and non-tradable equities (managed in the database)

    I cannot change the design of the database and I want to to get the result detailed in table5:


    How do I do that?

    Thank you for your patience.


    table1 - Balance Table
    equity_id FaceValue Balance
    xzy 100 500
    abc 100 250

    table2 - Tradable Equity
    equity_id corpId
    xzy 555442

    table3 - NonTradable Equity
    equity_id corpId
    abc 2345

    table4 - corpDesc

    corpDesc corpId
    abc Inc. 2345
    xzy inc. 55442

    table5: desired result
    equity_id balance facevalue corpId corpDesc
    abc 250 100 12345 abd inc.
    xzy 500 100 55442 xzy inc.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,931
    Can you confirm tables 2 and 3 are mutually exclusive - i.e. an equity can be in one table but not both

  3. #3
    udigold1 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2010
    Posts
    29
    Quote Originally Posted by Ajax View Post
    Can you confirm tables 2 and 3 are mutually exclusive - i.e. an equity can be in one table but not both
    On perfect world - they should be mutually exclusive
    Unfortunately, there could be instances of overlapping, because table2 is from an outside source I cannot control it 100%.
    I guess I need some sort of hierarchy - if not in table2 then go lookup in table2.

    thanks again

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,931
    you really need to think this through as it affects how the query would be constructed - what do you want happen when they are not mutually exclusive? - do they both have the same corpID field? do they both have exactly the same equity_id?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Join the data of two tables using query
    By Esmatullaharifi in forum Queries
    Replies: 1
    Last Post: 05-03-2015, 08:15 AM
  2. Replies: 11
    Last Post: 01-07-2015, 06:12 AM
  3. Replies: 6
    Last Post: 11-19-2013, 01:38 AM
  4. inner join query with three tables.
    By fabiobarreto10 in forum Queries
    Replies: 2
    Last Post: 01-30-2012, 07:34 PM
  5. Join 4 Tables in 1 Query
    By sandlucky in forum Queries
    Replies: 5
    Last Post: 06-12-2011, 06:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums