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
select distinct
i.itemnumber
sum(i.qty) as invqty
from [your inventory table name here] i
group by i.itemnumber
having sum(i.qty) 0
On 12/3/06, Terry Troxel [EMAIL PROTECTED] wrote:
I am having a senior moment and could use some help with a
sql select query I am attempting to use to
Terry Troxel wrote:
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
Jim Wright wrote:
SELECT inventory.ItemNumber, SUM(inventory.qty) as
invqty
FROM inventory
GROUP BY inventory.ItemNumber
HAVING SUM(inventory.qty) 0
oops...told you to take the DISTINCT out, and then left it in...see above.
Thanks all of you. Wow, I really enjoy this list when you
all pitch in and help each other like you just did.
Really Appreciate it.
Terry
-Original Message-
From: Jim Wright [mailto:[EMAIL PROTECTED]
Sent: Sunday, December 03, 2006 8:20 AM
To: CF-Talk
Subject: Re: Sql aggregate woes
:) know the feeling, jim...i completely overlooked the distinct, left out a
comma between the fields, and left out the table name even though it was
right there...lol. all of this snow up here must be affecting my brain
cells...all 2 of them. oh, well, at least terry got some valuable feedback
on
6 matches
Mail list logo