OK, so I am using MySQL and I have found a database that should be for news articles and In the database, I have two tables, one employee and other articles, employee ID and name etc. in the table staff, and table article contains information about article IDs and articles. Now what I have to do, I want to get all those employees who have not written any articles. I want to get employees and in what article id they are. For example:
employeeID | Name | Article 1 | Lorraine | 26 2 Jack | 22 2 Jack | 23 5 Clark | 25 5 Clark | 26 5 Clark | 27 2 Lorraine 28 2 Louise | 30 2 Louise. 31 2 Lewis | 33 Now this is where I think it is getting difficult, I can not get my head around it, I think that to collect both tables Join, and then use counting to know how many articles have been written by an employee, so while using two questions
select employees from select name, employee ID Article from article The information I requested I need to, but how can I collect it one of two questions, so I get it out of the above version
It should be omitted from the external participant
SELECT e.Name, e.employeeID, COUNT worker (a.ArticleID) and join the LEFT OUTER article on a.employeeID = E.employeeID Group by e.employeeID You can test the example working through.
No comments:
Post a Comment