query possible

Discussion in 'Databases' started by sensoryaddict, Mar 28, 2011.

  1. #1
    HI

    I basically have 2 table

    Table A = First_Name , Last_Name, Address

    Table B = First_Name, Last_Name, Social

    What I basically want to do is create a new field in Table A called "Social" and match and insert the socials from table B into Table A , where last name matches


    Thanks in advance
     
    sensoryaddict, Mar 28, 2011 IP
  2. sensoryaddict

    sensoryaddict Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    bump

    is this that hard?
     
    sensoryaddict, Mar 29, 2011 IP
  3. jkl6

    jkl6 Peon

    Messages:
    70
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    update tableA A set social = (select social from tableB B where B.last_name=A.last_name limit 1)
     
    jkl6, Mar 29, 2011 IP
  4. randheer

    randheer Greenhorn

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #4
    check out this also

    UPDATE TABLEA
    SET SOCIAL= B.SOCIAL

    FROM
    TABLEA A
    INNER JOIN TABLEB B ON B.LNAME=A.LNAME
     
    randheer, Apr 5, 2011 IP
  5. backlinkmaker

    backlinkmaker Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Update tablea
    set social= b.social

    from
    tablea a
    inner join tableb b on b.lname=a.lname
     
    backlinkmaker, Apr 5, 2011 IP
  6. sensoryaddict

    sensoryaddict Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    thanks this works great
     
    sensoryaddict, May 2, 2011 IP