Select Check_Num, Issued_To, sum(Amount) as Total, max(purDate_Purchased) as PurchaseDate >From TableName Group by Check_Num, Issued_To Order by Check_Num, Issued_To
Easy! Regards Dale Fraser http://learncf.com -----Original Message----- From: Travis Haley [mailto:[EMAIL PROTECTED] Sent: Tuesday, 2 October 2007 3:37 PM To: CF-Talk Subject: RE: Adding Small sections of a query The date part of the datetime is the same the time part differs but the time part is irrelevant to this report. I was able to get this to work by dropping the date out of the first query then running a second query in the cfoutput of the first query: <cfquery name="rsGetPurchaseDate" datasource="#application.dsn#" username="#application.dsnUsername#" password="#application.dsnPassword#" maxrows="1"> SELECT pur_Date_Purchased FROM tbl_HCFA_Purchase_Transactions WHERE Check_Num = #Check_Num# ORDER BY pur_Date_Purchased DESC </cfquery> This just seems like a hack and it takes a lot of time for the page to run now from 130ms up to 1380ms now on 200 records. I am just looking for a way to cut the timestamp off of the date in the first query. I didn't realize in my first question that the GROUP BY needed exact matching entries and has to group everything in the original SELECT I am using an ACCESS database and am curious how I would use min( or max( to get the oldest date for the current group. I tried putting max(pur_Date_Purchased) in my GROUP BY clause and am told no aggregate functions are allowed in GROUP BY. Travis Haley -----Original Message----- From: James Holmes [mailto:[EMAIL PROTECTED] Sent: Monday, October 01, 2007 7:38 PM To: CF-Talk Subject: Re: Adding Small sections of a query Which date do you want? You have multiple entries - which one should the query return? On 10/2/07, Travis Haley <[EMAIL PROTECTED]> wrote: > But I need the date, should I run this in a second query? > > Travis Haley > > -----Original Message----- > From: James Holmes [mailto:[EMAIL PROTECTED] > Sent: Monday, October 01, 2007 6:45 PM > To: CF-Talk > Subject: Re: Adding Small sections of a query > > Remove the date from the query. > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289890 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4