SELECT DISTINCT inventory.ItemNumber, SUM(inventory.qty) as invqty where
invqty > 0
GROUP BY inventory.ItemNumber.

All items not aggregated in a select must be also placed in a Group By
Clause. 

Sandra Clark
==============================
http://www.shayna.com
Training in Cascading Style Sheets and Accessibility


-----Original Message-----
From: Terry Troxel [mailto:[EMAIL PROTECTED] 
Sent: Sunday, December 03, 2006 9:30 AM
To: CF-Talk
Subject: Sql aggregate woes

I am having a senior moment and could use some help with a sql select query
I am attempting to use to populate a listbox with only those items that have
inventory.

SELECT DISTINCT inventory.ItemNumber, SUM(inventory.qty) as invqty where
invqty > 0

And I get the error I am not using 'ItenNumber' as part of an aggregate
function.

I have fixed this in the past, but am drawing a blank.

Terry




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262656
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to