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 |
junior6202
Starting Member
45 Posts |
Posted - 2014-05-15 : 11:49:12
|
So I'm new to SQL and I was asked to populate a table so I did and some of the columns where missing information and was told to write an "If Statement that would say if column A is null then use columns of second table". Any advice would be appreciated.Thank you. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-05-15 : 12:32:43
|
I can only help with SQL Server, but are you wanting an UPDATE to fix the data or an INSERT to fix the import? Where is the source data?INSERT INTO t1 (c1, c2, c3, c4)SELECT T2.c1, T2.c2, T2.c3, CASE WHEN T2.c4 IS NOT NULL THEN T2.c4 ELSE T3.c4 ENDFROM T2JOIN T3 ON T2.c1 = T3.c1Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|