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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SQL Server 2008 How two to get tables records in s

Author  Topic 

Srinishak1
Starting Member

4 Posts

Posted - 2014-03-02 : 10:12:38
SQL Server 2008 How two to get tables records in same database and get column is changed. But changed column values should come from Table B. Not required Table A value to similar records.

TABLE A

year week Product Qty Price

2013 1 A 20 150
2013 1 B 50 200
2013 2 A 90 100
2013 3 D 90 100
2013 1 C 100 205
2013 2 B 200 555
2013 3 C 300 333


TABLE B

year week Product Qty Price

2013 1 B 50 200
2013 2 A 90 111
2013 3 D 90 100
2013 1 C 100 350
2013 2 B 200 555
2013 3 C 300 444
2013 2 D 666 888


But I need the result set like below

2013 2 A 20 777
2013 1 A 20 150
2013 1 B 50 200
2013 2 A 90 111
2013 3 D 90 100
2013 1 C 100 350
2013 2 B 200 555
2013 3 C 300 444
2013 2 D 666 888

kindly help for this issue..




Rajan

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-03-02 : 11:25:22
Your output is not clear. Can you explain how you got the first row?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -