RE: Sql aggregate woes

2006-12-03 Thread Sandra Clark
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

Re: Sql aggregate woes

2006-12-03 Thread Dina Hess
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

Re: Sql aggregate woes

2006-12-03 Thread Jim Wright
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

Re: Sql aggregate woes

2006-12-03 Thread Jim Wright
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.

RE: Sql aggregate woes

2006-12-03 Thread Terry Troxel
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

Re: Sql aggregate woes

2006-12-03 Thread Dina Hess
:) 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