Reg: SQL Query..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rhepsi
    New Member
    • Apr 2007
    • 111

    Reg: SQL Query..

    hii...

    i have 3 tables...
    table 1, table 2 and table 3

    now in table 1 i have st_code and st_sponsored_by fields..
    st_sponsored_by is empty..

    in table 2 i have sponsor_group_i d_pk and sponsor_group_n ame

    in table 3 i have st_sponsor_grou p_id_fk and sp_st_code


    Now my requirement is such that...
    I want the table 1. st_sponsored_by to be updated with the sponsor_group_n ame from table 2, where the table 1's st_code is same as sp_st_code in table 3
    and table2.sponsor_ id_pk = table3.sp_st_co de


    i want the update query for updating st_sponsored_by in table 1..

    plz help...
    thnx..
    hepsi.
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    Originally posted by rhepsi
    hii...

    i have 3 tables...
    table 1, table 2 and table 3

    now in table 1 i have st_code and st_sponsored_by fields..
    st_sponsored_by is empty..

    in table 2 i have sponsor_group_i d_pk and sponsor_group_n ame

    in table 3 i have st_sponsor_grou p_id_fk and sp_st_code


    Now my requirement is such that...
    I want the table 1. st_sponsored_by to be updated with the sponsor_group_n ame from table 2, where the table 1's st_code is same as sp_st_code in table 3
    and table2.sponsor_ id_pk = table3.sp_st_co de


    i want the update query for updating st_sponsored_by in table 1..

    plz help...
    thnx..
    hepsi.
    [CODE=sql]update table1
    set table1.st_spons ored_by = table2.sponsor_ group_name
    from table2, table3
    where table1.st_code = table3.sp_st_co de
    and table2.sponsor_ id_pk = table3.sp_st_co de[/CODE]

    cheers

    Comment

    • rhepsi
      New Member
      • Apr 2007
      • 111

      #3
      Originally posted by Shashi Sadasivan
      [CODE=sql]update table1
      set table1.st_spons ored_by = table2.sponsor_ group_name
      from table2, table3
      where table1.st_code = table3.sp_st_co de
      and table2.sponsor_ id_pk = table3.sp_st_co de[/CODE]

      cheers

      THNX.. so muxh.. it worked

      Comment

      Working...