Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Query 1:N

Discussion in 'Information Technology' started by Arturo Guzman, Jul 28, 2006.

Tags:
  1. Arturo Guzman

    Arturo Guzman
    Expand Collapse
    Guest

    Hello i have a problem with a query of the folowing table:

    Client

    IdClient
    Name
    Adress
    ......
    IDBANKBUY
    IDBANKSELL

    Banks

    IDBANK
    NAME
    ADDRESS

    IDBANKBUY and IDBANKSELL is relationed to IDBANK, so I need to get the
    client data (Name,Address) and the name of the bank where the client
    buys and sells.

    Im using Access 2003.

    Regards.
     
  2. Loading...

    Similar Threads Forum Date
    Query about Jhatka Meat by Shooting in Head Sikh Sikhi Sikhism Aug 26, 2011
    Who is a sikh? A non sikh friend's query!! Sikh Sikhi Sikhism Apr 30, 2010
    General Query Hard Talk Sep 4, 2008
    Power of pauri's in Japji Sahib query Sikh Sikhi Sikhism Aug 17, 2006
    Sikhism a query Book Reviews & Editorials Aug 2, 2005

  3. Arvin Meyer [MVP]

    Arvin Meyer [MVP]
    Expand Collapse
    Guest

    If the client always buys AND sells at the same bank, you only need 1 bank
    ID in the client table, if it can be 2 different banks, you need to have 2
    separate queries. One query joined on IDBANKBUY and the other joined on
    IDBANKSELL. Then create a 3rd query as a UNION of the first 2. It would look
    something like:

    SELECT Client.Name, Client.Address, Banks.Name, Banks.Address
    FROM Client INNER JOIN Banks ON Client.IDBANKBUY = Banks.IDBANK
    UNION SELECT Client.Name, Client.Address, Banks.Name, Banks.Address
    FROM Client INNER JOIN Banks ON Client.IDBANKSELL = Banks.IDBANK

    --
    Arvin Meyer, MCP, MVP
    Microsoft Access
    Free Access downloads
    http://www.datastrat.com
    http://www.mvps.org/access

    "Arturo Guzman" <juantalamero@hotmail.com> wrote in message
    news:ea7cp8$26e$1@nsnmrro2-gest.nuria.telefonica-data.net...
    > Hello i have a problem with a query of the folowing table:
    >
    > Client
    >
    > IdClient
    > Name
    > Adress
    > .....
    > IDBANKBUY
    > IDBANKSELL
    >
    > Banks
    >
    > IDBANK
    > NAME
    > ADDRESS
    >
    > IDBANKBUY and IDBANKSELL is relationed to IDBANK, so I need to get the
    > client data (Name,Address) and the name of the bank where the client buys
    > and sells.
    >
    > Im using Access 2003.
    >
    > Regards.
     

Share This Page