Thread: update in MySQL

    #1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Posts
    26
    Rep Power
    0

    update in MySQL


    [Sandeep Murphy]

    Hi,



    I need to update an entire table in one database with the values from another database... My query reads like this:

    update palmeira.t_colaboradores t, hr.member_status s, hr.member_data d

    set t.structure=s.structure, t.depart_area=s.area where t.cs_id=d.cs_id and d.cs_id=125
    [Sandeep Murphy]

    in the query, plameira and hr are the 2 diff databases....

    any suggestions as to how to make this work???

    tia,

    sands
    P.S: am using MySQL server 3.23
  2. #2
  3. No Profile Picture
    Java Developer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Posts
    5
    Rep Power
    0
    I wouldn't do this in java unless they were small tables, and if so then why not do it by hand. I'd have thought it'd be slow, and if you wanted to do it on a regular basis, more relevantly it'd be a waste of coding time

    There are loads of tools about one of them is sure to do database table migration (more than likely a db backup tool).

    It could be done though by getting 2 db connections, and getting a result set from one and writing from cycling through it to the other
  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Posts
    26
    Rep Power
    0
    solved it sometime bak... was too slow using java... used a php script to do it...


    thnx anyway..

    cheers,
    sands

IMN logo majestic logo threadwatch logo seochat tools logo