Assuming you are using MySQL (as the question is tagged), the following will return an arbitrary value for the other columns:
select *from tgroup by code;
However, the particular values being selected come from indeterminate rows.
Building up on Gordon's answer, you can order a sub-query so that the group by will always return the lowst quantity for each code.
select *from (select * from t order by code desc, quantity asc)group by code;