Help with a basic SQL query [closed]
How do I write an SQL query to find out which employees are from a single location where employee and location are different table.
select count(*) from employee;
The above gives only the count of employees but I need to display their name and location
COUNT
will obviously give you only the count of the number of employees.
For specific columns such as 'name' and 'location', just do:
SELECT e.name, l.location
FROM employee e
JOIN location l ON e.location_id = l.location_id
(or JOIN on whatever is the common association column between the employee
and location
table)
精彩评论