Ok once again here is my database setup (the whole thing this time)
Table = Lists
ListName
ItemName
AmtNum
AmtType
Table = Items
ItemName
Category
Table = Prices
ItemName
AmtType
Price
and here is the SQL statement I am trying to get to work (for test purposes I am not using any variables)
sSQL = "SELECT Lists.ItemName as ItemName, Lists.AmtType as AmtType, Lists.AmtNum as AmtNum, Item.Category as Category, SUM(Lists.AmtNum * Prices.Price) as Total FROM Lists, Items, Prices WHERE ListName = list1 AND Lists.ItemName = Items.ItemName AND Lists.ItemName = Prices.ItemName AND Lists.AmtType = Prices.AmtType ORDER BY Total ASC;"
and I keep on getting Error 3122 - "You tried to execute a query that doesn't include the specified expression 'ItemName' as part of the aggregate function". I didn't receive this error until I started using the SUM function in the SQL statement so I imagine that I am not using it properly. Any explanations of what I need to do/change?




Reply With Quote