The database name is employee-information in that database I was trying to show one "person_name" column that is available in both tables "works" & "employee" by using two different conditions that will filter values in each table.
So that I can see the values filtered by the two conditions from both tables in one single "person_name" column.
work & employee tables,
Here is what I have done so far,
USE employee_information;
SELECT employee.person_name, works.person_name
FROM employee, works
WHERE city = "Miami" AND salary > 50000;
The result I am getting,
For that command I am getting this two-column from both table. Conditions are working but values are repetitive and there are two columns but I need to show one column filled with the value from both tables where those two conditions are true
My desired result is,
person_name//table name
Alex //values those are true by both condition in each table
Robin Hood
>Solution :
You need to join the tables using person_name as the relationship.
SELECT employee.person_name
FROM employee
JOIN works ON employee.person_name = works.person_name
WHERE employee.city = 'Miami' AND works.salary < 50000;


