By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,419 Members | 1,636 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,419 IT Pros & Developers. It's quick & easy.

make one table from merging two

100+
P: 232
i hav two tables
table1
fiels;sid,sname,saddress
table2
fields;sid,smarks,sresult
where i can use sid as join condition
i want to make only one table from these two
kindly give steps for doing it
Jul 14 '09 #1
Share this Question
Share on Google+
3 Replies


ck9663
Expert 2.5K+
P: 2,878
yes, use join...

what do you have so far?

happy coding !!!

-- CK
Jul 15 '09 #2

P: 10
SELECT * FROM
Table1 INNER JOIN Table2 ON Table1.SID=Table2.SID

OR

SELECT table1.*,Table2.* FROM
Table1 INNER JOIN Table2 ON Table1.SID=Table2.SID

HAPPY QUERY...
- Pankaj Tambe
Jul 15 '09 #3

P: 5
Option 1

If you want to merge these 2 tables,

Steps:

1. Alter table table1 (means, change designing of Table1) and add columns of table2 (i.e. smarks & sresult).

2. Write update query using join.

Update Table1
set smarks=t2.smarks
sresult=t2.sresult
from table1 t1 inner join table2 t2 on
t1.sid=t2.sid

3. "drop table table2" Query to delete table2 as it is no more in use for u.

Another Option

If u dont want to above then u can create one view which will have merged output. And u can use that view as table anywhere. But u cant update view from outside.

So, as per your requirement, use the best option.

Regds,
Jul 16 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.