select sum(importe) from facturawhere oficina = 8and cliente = 1399and MONTH(fecha) >= MONTH(today)-6and year(fecha) = year(today)
select sum(importe) from facturawhere oficina = 8 and cliente = 1399 and (fecha>= (extend(today) - 6 units month) and fecha <= today)