I want to only return the rows were Spent>Budget. Any ideas how I can
do it? I tried adding 'HAVING Spent>Budget' but I got an error. Also
tried wrapping the select with another select and a where clause, but
that errored. Any help is appreciated.
--------------------
Select
J.Job,
J.Description,
sum(IF(Transaction_Type='Original estimate' or
Transaction_Type='Approved est changes',Amount,0)) as Budget,
sum(IF(Transaction_Type='AP cost' or Transaction_Type='JC cost',Amount,
0)) as Spent
From
JCM_MASTER__JOB_1 J Inner Join JCT_CURRENT__TRANSACTION T On J.Job =
T.Job
Where T.Transaction_Type In ('Original estimate', 'Approved est
changes','AP cost','JC cost') And
J.Status = 'In progress' And
T.Category = '1'
GROUP BY J.Job, J.Description


|