looking for some solutions? You are welcome.

SOLVED: SQL Server 2008 R2 Help Select Certain Column from Table1 and Insert to Certain Column in Table2 with Where Clause Conditions

RchLuvSlly:

Table1:

|Id|Category_Id|Type_Id|Code|
+--+-----------+-------+----+
|1 |1          |1      |A   |
|3 |2          |1      |B   |
|4 |1          |3      |C   |

Table2:

|Id|Category_Id|Type_Id|Code_Id|
+--+-----------+-------+-------+    
|1 |1          |1      |NULL   |
|3 |2          |1      |NULL   |
|5 |9          |7      |NULL   |

As you can see, the column 'Code_Id' in Table2 is NULL. I need to update that column with the values from column 'Id' in Table1 with condition where values in columns 'Category_Id' and 'Type_Id' in Table1 match values in columns 'Category_Id' and 'Type_Id' in Table2.

How am I supposed to do that? Thank you and looking forward to your kind help.



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent