dbTalk Databases Forums  

Limit Group By Results

comp.databases.btrieve comp.databases.btrieve


Discuss Limit Group By Results in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
spraycan77
 
Posts: n/a

Default Limit Group By Results - 03-02-2008 , 10:08 PM






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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.