Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Update Multiple Column Set Select Statement! Help!

Author  Topic 

sikharma13
Starting Member

44 Posts

Posted - 2013-11-14 : 16:30:52
i have a table named masterlist wherein
the columns are :

name-----age------sex
andrew---19-------male
trisha---23------female


and i have also another table which is namelist
that is linked to the masterlist table..


after i search for the record andrew in the table namelist
i updated andrew as 25 and sex is female..


now i want reset andrew's record, same to the
records that andrew has in the table masterlist..
what query do i need to use??

thanks!

VFP9.0 via MySQL 5.0

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2013-11-14 : 19:47:14
[CODE]update nl
set age = ml.age,
sex = ml.sex
from namelist nl
inner join
masterlist ml
on ml.name = nl.name[/CODE]HTH

=================================================
No, no, you're not thinking, you're just being logical. -Niels Bohr
Go to Top of Page

sikharma13
Starting Member

44 Posts

Posted - 2013-11-14 : 19:54:30
ill rephrase my topic..

i think it kinda confused me.. so this is much simple problem..

I have a table ed_abcdeeh with columns
(school_id,name_of_school,level)

Another table m_abcdeeh with columns
(school_id,name_of_school,grade_level)


I want to update all rows in table ed_abcdeeh with values from m_abcdeeh

VFP9.0 via MySQL 5.0
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-11-14 : 23:07:29
UPDATE ea
ea.name_of_school = ma.name_of_school ,
ea.level = ma.grade_level
FROM ed_abcdeeh ea
JOIN m_abcdeeh ma
ON ea.school_id = ma.school_id


--
Chandu
Go to Top of Page
   

- Advertisement -