如何提取字段重复值的值?

How can I extract values where there are repeated values of fields?

来自以下table,

userId passageId score
1      1         2
1      2         3
1      1         4
2      1         3
2      3         3
2      3         4

当 passageId 的前两个值对于每个 userId 值都相同时,是否可以提取如下所示的分数。

userId passageId score_1 score_2 
1      1         2          4
2      3         3          4

这看起来像最小值和最大值:

select userid, passageid, min(score), max(score)
from t
group by userid, passageid
having count(*) > 1;

DBFIDDLE

SELECT 
   userId,
   passageId,
   min(score) as score_1,
   max(score) as score_2
FROM mytable
GROUP BY    
   userId,
   passageId
HAVING COUNT(*)>=2;