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.
| Author |
Topic |
|
thehandsomecode
Yak Posting Veteran
51 Posts |
Posted - 2007-09-14 : 12:07:57
|
| i have two databases one hasfirstname, lastnameand the otherefirstname, lastname, emailaddresshow do i get to merge the data from emailaddress to the 1st datbase?Melvin FelicienIT ManagerDCG Properties Limited |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2007-09-14 : 12:22:10
|
| USe UNION ALL STATEMENT |
 |
|
|
thehandsomecode
Yak Posting Veteran
51 Posts |
Posted - 2007-09-14 : 12:26:13
|
| i am not that good with SQL can you guide me?Melvin FelicienIT ManagerDCG Properties Limited |
 |
|
|
thehandsomecode
Yak Posting Veteran
51 Posts |
Posted - 2007-09-14 : 12:27:45
|
| i also need it to make the union or merge based on when the first name and lastname matched a record in the 2nd tableMelvin FelicienIT ManagerDCG Properties Limited |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-14 : 12:29:11
|
insert into table1 (firstname, lastname)select firstname, lastname from table2where not exists (select * from table1 as t1 where t1.firstname = table2.firstname and t1.lastname = table2.lastname) E 12°55'05.25"N 56°04'39.16" |
 |
|
|
thehandsomecode
Yak Posting Veteran
51 Posts |
Posted - 2007-09-14 : 13:19:05
|
| Thank you. this seems to work to input new data but what i want is to append the data to an existing record.okay here it is.i have two identical databases. one contains emailaddresses and theother doesnt. i want to inset the email addresses next to the correct names.Please help.Melvin FelicienIT ManagerDCG Properties Limited |
 |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2007-09-22 : 09:15:20
|
| In that case , use an UPDATE statement. For example , update t1 set t1.field=t2.fields from table1 t1 inner join table2 t2 on t1.primaryKey=t2.foreignkeyJack Vamvas--------------------Need an IT job ? http://www.ITjobfeed.com |
 |
|
|
|
|
|