开发者

Merge two columns data into one column in another first table

I want a query, in my case table1 and table 2 have different structure but id is the common field all i want is find the way to display the data from table1 and table2. on ===> id table1 = id table2 into table1

For example dbo.Personal_details having Emp_ID and dbo.Employees having the same column Emp_ID. I want to merge the Emp_ID values into dbo.Personla_details.

Personal_details:                  Employees:

Emp_id                             Emp_ID
1                                  1
2                                  2
3                                  3
4                                  4
5                                  5
6                                  6
7                                  7
8                                  8
                              开发者_JAVA百科     9 
                                   .
                                   .
                                   upto 550 records in this table

So, i want merge the Emp_ID of Employees into Emp_ID of Personal_Details. How i merge the details.

Please Help me,

Thanks in advance,

Naresh.


Hope this will Help You....

MERGE <target_table> [AS TARGET]
USING <table_source> [AS SOURCE]
ON <search_condition>
[WHEN MATCHED 
THEN <merge_matched> ]
[WHEN NOT MATCHED [BY TARGET]
THEN <merge_not_matched> ]
[WHEN NOT MATCHED BY SOURCE
THEN <merge_ matched> ];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜