【发布时间】:2017-01-28 14:40:53
【问题描述】:
我有以下数据结构
| Name | Contract Type |
|:------|--------------:|
| Frank | Student |
| Frank | Staff |
| Frank | Staff |
| John | Internship |
| John | Student |
| John | Staff |
| Tim | Internship |
| Tim | Staff |
我想获得在他们的历史上有过学生合同和另一个合同的员工的Names。我的方法是
Select Name, count(Name) from table
where ContractType = ('Student') AND (ContractType = ('Staff') OR ContractType = ('Internship') )
group by Name having count (Name) > 1
这里的问题是我仍然得到所有员工。谁能帮我完成这项工作?
【问题讨论】: