Results 1 to 5 of 5

Thread: Query stuff

  1. #1
    Join Date
    Mar 2004

    Unanswered: Query stuff

    I'm sure this has been answered somewhere else, but I don't know exactly what I should be looking for.
    I'm just going to write down what I'm looking at conceptually...

    Table A
    ID stuff
    1 x
    2 x
    3 x

    Table B
    ID greek
    1 alpha
    2 beta

    Table C
    ID color
    2 red
    3 orange

    Table B and C are connected to Table A through the number ID. What I want to do is get an output from SQL like this:

    ID, greek, color
    1, alpha,
    2, beta, red
    3, , orange

    I've been fooling around with different queries without success. I've done inner joins, but that only gets me where both 'greek' and 'color' exist, I've unioned them getting a mess with 'greek' and 'color' in the same field, and then I've exported both to a third table but then ID is repeated.

    I'm a general newbie to DB stuff, so I've been looking at it off and on for three days and haven't figured anything out.

  2. #2
    Join Date
    Feb 2004
    use left/rigth Join instead inner join
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

  3. #3
    Join Date
    Dec 2003

    join your joins

    Try creating two separate queries.

    One joining table a and table b

    Then another query joining table a and table c

    Then do another query joining tables a query 1 and query 2 and set the relation ship up so that every record from table a is included and all matches from query 1 and query 2.

    This should give you the results you are looking for.


  4. #4
    Join Date
    Jan 2004

    Re: Query stuff

    Im writting this off the top of my head but cant see why it wont work

    select Table B.ID, Table B.greek from Table B inner join Table B.ID on Table A.ID = Table B.ID
    select Table C.ID, Table C.greek from Table C inner join Table C.ID on Table A.ID = Table C.ID

  5. #5
    Join Date
    Mar 2004
    Ah, yes. Left joins worked excellently. Thanks very much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts