select count(*) FROM table_name A WHERE ROWID >
( SELECT min(rowid) FROM table_name B
WHERE A.key_values = B.key_values);
--------------------------------------------
select count(*) from my_table where rowid not in(
select max(rowid) from my_table
group by my_column_name );
-------------------------------------------
select count(*) from my_table t2
where t2.key_value1 = t1.key_value1
and t2.key_value2 = t1.key_value2
and t2.rowid > t1.rowid;