If your RDBMS supports analytic functions then the optimum method is almost certainly this:
select code, date, rate, last_rate
from
(
select code,
date,
rate,
lag(rate) over (partition by code order by date) last_rate
from ratetable
) my_tb
where my_tb.rate != my_tb.last_rate