我有一个带有"日期"列的表.每个日期可能会出现多次.如何仅选择出现的日期 另见@ [SQLMenace]的回复.它与此非常相似,但是根据您的数据库,他的JOIN可能会运行得更快,假设优化器不会产生差异.
1> Joel Coehoor..:SELECT * FROM [MyTable] WHERE [Date] IN
(
SELECT [Date]
FROM [MyTable]
GROUP By [Date]
HAVING COUNT(*) < @Max
)
select dates from table t group by dates having count(dates) < k ;
希望它适用于ORACLE.HTH