codice:
select *,
if(datediff(data_fine,data_inizio) > 7,prezzo_1+prezzo_2+extra,prezzo_1+prezzo_2) as prezzo
from tabella