but that returns too many rows and I do not understand why
It returns more than the expected rows because there can be multiple rows fulfillingthe conditions (in the example, rows with id 6 and 7 will both appear as both have the max(sale) for idone = 020 and idtwo = 230)
How can I resolve this ?
It depends if you want to show all the rows with max(sale) (which you're already doing so I suppose you don't want that), if you want to show the first one to be found or if you want to show the last one to be found.
If you only want the first one, you could do something like:
SELECT min(a.id) as id, a.IDone, a.IDtwo, a.sale FROM TableA a INNER JOIN (SELECT IDone, IDtwo, max(sale) AS maxsale FROM TableA GROUP BY IDone, IDtwo) b ON a.IDone = b.IDone AND a.IDtwo = b.IDtwo AND a.sale = b.maxsale GROUP BY a.IDone, a.IDtwo, a.sale;