0
Sql query
If i have 2 tables TB1 contains Acc no,name,age and TB2 contains Acc no,Salary,id..... i want to add 10,000 in salary who r all above age 40 in TB1....What is the query in SQL?
1 Answer
0
You can use join with account number. Check this query. Don't forget to add where clause to check age > 40
UPDATE TB2
SET TB2.Salary = 10000
FROM TB2 t
INNER JOIN TB1 s
ON t.account_no = s.account_no
WHERE s.age > 40
Advice - Before update main data you should check on raw data.