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 |
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2013-10-15 : 23:01:39
|
i have 2 tables:tableA:ID Code Depart Arrival10 DoubleAAtableB:ID Journey Depart Arrival10 first UK US10 second US UKHow can I replace in tableA for NULL Depart and Arrival column to the one in tableB which is the first journey.expected result:tableA:ID Code Depart Arrival10 DoubleAA UK US |
|
VeeranjaneyuluAnnapureddy
Posting Yak Master
169 Posts |
Posted - 2013-10-16 : 00:25:22
|
Select Id , Code , Depart = (Select Depart From Table2 Where Journey = 'First') , Arrival = (Select Arrival From Table2 Where Journey = 'First') From Table1 veeranjaneyulu |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-10-16 : 02:07:45
|
[code]UPDATE aSET a.Depart = b.Depart,a.Arrival = b.ArrivalFROM tableA aINNER JOIN TableB bON b.ID = a.IDAN b.Journey = 'first'[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|