I need compare the sum of one column, this could be less or equal than other value in other table. So I have this, but I don’t know how make the sintax
SELECT sembrado.f_AreaSiembra, tenencia.f_AreaDedicadaCultivos
FROM Clt_Sembrado as sembrado
INNER JOIN Fnc_TenenciaUsoTierra as tenencia ON sembrado.c_Fk_IdBoleta = tenencia.c_Fk_IdBoleta
HAVING (SUM(sembrado.f_AreaSiembra) <= tenencia.f_AreaDedicadaCultivos) AND (sembrado.c_Fk_IdBoleta = 45550711 AND tenencia.c_Fk_IdBoleta = 45550711)
How can I do this??
thanks
It sounds like you just want the conditions in the where clause: you can still use WHERE within the aggregated.
I haven’t tested, so might be small syntax errors.