Coba:
SELECT t1.id, t1.name, t1.account
, (SELECT COUNT(*)
FROM tableName t2
WHERE t2.name = t1.name
AND t2.account = t1.account
AND t2.id <= t1.id) AS dupno
FROM tableName t1;
Keluaran :
ID NAME ACCOUNT DUPNO
-- ---- ------- -----
1 ABC PQR 1
2 DEF PQR 1
3 ABC PQR 2
4 XYZ ABC 1
5 DEF PQR 2
6 DEF ABC 1