Reputation: 61
I have this table :
Code Nom Prenom
192 Potter Harry
192 Granger Hermione
197 Malfoy Drago
I need to have a result likt that :
Code Nom Prenom count
192 Potter Harry 2
192 Granger Hermione 2
197 Malfoy Drago 1
I try with having, but i can't with 'Nom' and 'Prenom' only the count. Have you a solution ? Thanks
Upvotes: 0
Views: 420
Reputation: 3400
SELECT
Code,
Nom,
Prenom,
COUNT(*) OVER (PARTITION BY Code) AS MyCount
FROM
MyTable
Upvotes: 4