Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个表“员工”,如下所示
Id Name 1 John 2 Jaffer 3 Syam 4 Aish 5 Gidson 1 Aboo 2 Sindhu 3 Saravanan
我想得到两个输出,比如
Id 1 2 3 Id 4 5
我应该使用哪种转换?
你能帮忙吗?
您将不得不编写两个查询。
SELECT Id FROM Employee GROUP BY Id HAVING COUNT(Id)>1
上面的查询会给你第一个输出
SELECT Id FROM Employee GROUP BY Id HAVING COUNT(Id)=1
这将为您提供第二个输出。