join problem

  • Hi guys

    I need to perform a join on two tables which have got 1 common field named 'Provider'.

    The first table is the master table and the second table has got detailed description of the 'provider'

    I want to create a new table with all the 'providers' listed in the first table and details of the providers from second table but for only those providers listed in the master table .

    The problem is there is no unique field in the master table.

    how do i do this?

     

    thanks

    mita

  • So there's no primary key on master table?

    You could do a distinct from master and perhaps use an aggregate from the child table with a LEFT JOIN.

    ******************
    Dinakar Nethi
    Life is short. Enjoy it.
    ******************

  • The query below assumes Provider is the unique key on Master table. If Not u will get duplicate information.

    Select mastertable.Provider,mastertable.col1,mastertable.col2,

    mastertable.col3,...childtable.col1,Childtable.col2...

    from mastertable LEFT OUTER JOIN childtable on mastertable.Provider = childtable.Provider

    Thanks

    Sreejith

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply