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.
可能重复: 将 SQL 查询写入下表中的 SELECT 项
我无法弄清楚如何编写一个 SELECT 查询,该查询从表中选择列中具有多个相同单元格值的每个单元格。例如,如果列名称为“汽车”,则仅当“福特”在列中占据多个单元格时才选择“福特”。
您可能需要使用 Have 子句。
SELECT count(*), cars FROM table GROUP BY cars HAVING count(*) > 1
这是一个没有额外列的版本:
Select cars from (select cars, count(*) as nbr from theTable group by cars) where nbr > 1;