Wednesday, March 7, 2012

possible SQL query for this function?

i am trying to write an SQL query for an Access database. in this database i have a table with inventory data. what i want is to select distinct item numbers and sum up all of the inventory quantity for those item numbers. i know how to select distinct item numbers OK from this table, but how can i go through the table and sum the quantities for those item numbers and dump all the results into a new table? that would mean for each distinct item number, there would be one resulting sum for that item. so the table would be 2 columns, one with distinct item numbers and one with their sums. thanks for any help!GROUP BY

-PatP|||Since it is F-F-F-Friday and I'm seeing out the last 30 mins...


SELECT MyDisinctCol, Sum(QuantityCol) AS TheTotal
FROM MyTable
GROUP BY MyDisinctCol

Another 20 secs gone!|||that did it! thanks for the help...

No comments:

Post a Comment