开发者

Help with a basic SQL query [closed]

It's difficult to tell what is being asked 开发者_Go百科here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜