… Donde cuenta (col)> 1
Tengo una mesa como esta:
+-----+-----+-------+
| id | fk | value |
+-----+-----+-------+
| 0 | 1 | peter |
| 1 | 1 | josh |
| 3 | 2 | marc |
| ... | ... | ... |
Ahora me gustaría obtener todas las entradas que tengan más de un valor. El resultado esperado sería:
+-----+-------+
| fk | count |
+-----+-------+
| 1 | 2 |
| ... | ... |
Intenté lograr eso así:
select fk, count(value) from table where count(value) > 1;
Pero a Oracle no le gustó.
Así que intenté esto ...
select * from (
select fk, count(value) as cnt from table
) where cnt > 1;
... sin éxito.
¿Algunas ideas?