Re:Relational Lookups (join confusion)

From: Ike (rxv_at_hotmail.com)
Date: 10/18/03

  • Next message: Burt Peltier: "Re: does oracle connection equal one row in v$sessions?"
    Date: Sat, 18 Oct 2003 02:16:54 GMT
    
    

    Suppose I have tableA:

    id associate1 associate2
    1 1 2
    2 1 3

    And tableB

    id associatename
    1 jack white
    2 bill brown
    3 joe green

    The values for tableA.associate1 and tableA.associate2 are keys into tableB

    In wishing to display, say, the textual names (the associatenames in tableB)
    for a given record in tableA then, I would have the following statement (or
    so I believe!):

    SELECT tableB.associatename, tableB.associatename from tableA,tableB where
    tableA.associate1 = tableB.id and tableA.associate2 = tableB.id

    Of course, this only returns a row when
    tableA.associate1==tableA.associate2. Can someone please illuminate me as to
    what I am missing here? Thanks, Ike


  • Next message: Burt Peltier: "Re: does oracle connection equal one row in v$sessions?"

    Relevant Pages

    • Re: Query performance
      ... Please post DDL, so that people do not have to guess what the keys, ... that you have no data dictionary, no data model and do not enforce ... CREATE TABLE TableA ... CREATE TABLE TableB ...
      (microsoft.public.sqlserver.programming)
    • Re: Cursors (again)
      ... What does it matter if TableB is temporary? ... or tableA. ... open cTableB ...
      (microsoft.public.sqlserver.programming)
    • Re: SQL: Working with huge tables of chronological data
      ... TableB is ~30 millions row and contains (timestamp, ... from tableA TA1 left outer join tableB TB on (TA1.timestamp < ... that portion of the plan was executed. ...
      (comp.databases.oracle.server)
    • Re: Dazed and Confused
      ... related to the records in TableB, *and* how EACH record in TableB is related ... to the records in TableA. ... Purchase Order Details Table to a Purchase Order Table ... Junction table to the Purchase Requisition table. ...
      (microsoft.public.access.tablesdbdesign)
    • Re: SQL: Working with huge tables of chronological data
      ... TableB is ~30 millions row and contains (timestamp, ... from tableA TA1 left outer join tableB TB on (TA1.timestamp < ... the predicate information for ID 9 come from? ...
      (comp.databases.oracle.server)