oracle按单个字段分组

按不同单个字段分组结果查询不分组字段
SELECT ID FROM (
SELECT 
ID,
NAME,
TASK_VERSION,
COUNT(ID) OVER (PARTITION BY NAME)AS NUM, --单个字段分组
MIN(TASK_VERSION) OVER (PARTITION BY NAME) AS TASK_VERSION1 --单个字段分组
FROM ITEM_MAIN_LIST 
WHERE ISONLINK='2222'--查询条件
) 
WHERE TASK_VERSION1 = TASK_VERSION AND NUM>1 --查询条件

你可能感兴趣的:(sql)