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?

8th Dec 2019, 1:12 PM
Cheliyan
Cheliyan - avatar
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.
8th Dec 2019, 1:19 PM
A͢J
A͢J - avatar