It would appear that you have found a bug. I've reproduced your error as well. When computing a sum on a column it is missing the where clause.
I'd report it to macromedia and see what they have to say... Now, to solve your problem... What database are you using? Can you run this as a stored proceedure? Jeff Garza -----Original Message----- From: Daniel Quinones To: CF-Talk Sent: 2/14/02 5:24 PM Subject: Strange Query of Query Behavior Hello, I am doing a query that extracts all sales info for an employee in a particular time frame. Then I am doing 2 querys of that query as seen: <cfquery name="SalesCalc1" dbtype="query">SELECT SalesAmount AS Sales1Sum FROM SalesQuery Where BonusDeal= 1</cfquery> <cfquery name="SalesCalc2" dbtype="query">SELECT SalesAmount AS Sales2Sum FROM SalesQuery Where BonusDeal= 0</cfquery> This is working correctly, showing 2 different (correct) values for the amounts. Sales1Sum: 10,000 Sales2Sum: 15,000 But, when I want to use the SUM function in the SQL it shows totals for both as the same total. <cfquery name="SalesCalc1" dbtype="query"> SELECT SUM(SalesAmount) AS Sales1Sum FROM SalesQuery Where BonusDeal = 1</cfquery> <cfquery name="SalesCalc2" dbtype="query"> SELECT SUM(SalesAmount) AS Sales2Sum FROM SalesQuery Where BonusDeal = 0</cfquery> Sales1Sum: 25,000 Sales2Sum: 25,000 So it appears that the Query of Query is not taking the WHERE clause into consideration...... Any Ideas on why? Is this a Bug? How should I proceed? Thanks Everyone, -Dan ______________________________________________________________________ Why Share? Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation � $99/Month � Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

