Link to home
Start Free TrialLog in
Avatar of budi saleh
budi saleh

asked on

Sum coloumn in mysql

Dear Experts,

I want to add two coloumn ( salary 1 and salary 2 )  from table salary  with condition "Where Address_name ="singapore",

Attached the table :

Appreciate for the answer,

Thank you

User generated image
ASKER CERTIFIED SOLUTION
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I can see that you already have columns salary1 and salary2 on address table. So I'm guessing that you want to add these columns to another table and copy its contents.

On which table do you want to add these columns? On address? If so you can add the column and make it nullabe so only a few records will have this data.

Or maybe you want just get all the information together on a query for the addresses of singapore? If so you should execute a query similar to this:

SELECT Name, Address_name, Salary_1, Salary_2
FROM name n INNER JOIN address a ON n.Name_id = a.Name_id INNER JOIN salary s ON s.Name_id = n.Name_id
WHERE Address_name = 'singapore';

Hope this helps. Regards.
Avatar of budi saleh
budi saleh

ASKER

Thank everyone...appreciate the help from both of you..