Not Sure with my solution.If you want to delete records which is repeated less than or equal to 2,then try like this,
Edit:2
delete from transaction_detailswhere bill_no in (
select b.bill_no from transaction_details as a right join (
SELECT count(*) as count, bill_no
FROM transaction_details
GROUP BY bill_no
HAVING COUNT(*)<=2
) as b on a.bill_no=b.bill_no
);
Or if you want to delete records with count > 2, do like this
delete from transaction_detailswhere bill_no in (
select b.bill_no from transaction_details as a right join (
SELECT count(*) as count, bill_no
FROM transaction_details
GROUP BY bill_no
HAVING COUNT(*)>2
) as b on a.bill_no=b.bill_no
);