> How do I get either of these statements to work? I could
> have sworn I've done this a million times before but it's late
> and my brain is caffeine-clogged...
>
> I want to select records where the sum of the severity_minutes
> field is greater than 30?
I'm a bit tired myself, and not exactly a SQL guru, but I think you'll need
to use the GROUP BY clause, and put your filtering condition within a HAVING
clause. You also shouldn't need the DISTINCT keyword:
SELECT instance,
SUM(severity_minutes) AS sev_sum
FROM history_view
GROUP BY instance
HAVING SUM(severity_minutes) > 30
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists