Create a view with columns for YEAR(cl2.logdate), MONTH(cl2.logdate) and
DAY(cl2.logdate) then group on the year month and day columns
> Can anyone out there assist me with this query? I need to count two
> sets, differentiated by a text field and grouped by yet another field.
> Here's what I have:
> SELECT COUNT(*) as count_ttl,
> DATEPART(dy, logdate) as doy,
> DATEPART(yyyy, logdate) as yr,
> DATEPART(mm, logdate) as mnth,
> DATEPART(d, logdate) as dy,
> (SELECT COUNT(*)
> FROM customer_log as cl1
> WHERE logtype <> 'callout'
> AND cl1.logdate = cl2.logdate) AS count_in
> FROM customer_log as cl2
> WHERE logdate BETWEEN #start# AND #DateAdd('D', 1, end)#
> GROUP BY DATEPART(dy, logdate), DATEPART(yyyy, logdate),
> DATEPART(mm, logdate), DATEPART(d, logdate)
> ORDER BY DATEPART(dy, logdate)
> The problem is that cl2.logdate is not used in the GROUP BY clause nor
> can I use it. Logdate contains a time stamp which screws up the GROUP
> BY day functionality which is necessary for my report, thus the
> DATEPART. Basically, I'm counting all lines in a date range but also
> need to count just the lines in which the logtype is a specified value.
Isaac Dealey
Certified Advanced ColdFusion 5 Developer
www.turnkey.to
954-776-0046
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
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