Hello lovely people,
I'm trying to Group By ProductName, then Count the ProductNames that are still pending an AssetNumber.
InventoryTable
ProductName AssetNumber
ProductA pending
ProductA pending
ProductA pending
ProductB 1234
ProductB 1234
ProductC 5678
ProductC 5678
ProductD pending
ProductD pending
Question/Problem:
Count of ProductNames with AssetNumber equal to "pending" is : 2 . I'm having issues trying to get the count of 2. I'll later put this value in a text box. This is what I have tried so far (+20 variations).
SELECT InventoryTable.[ProductName], Count(*) AS Expr1
FROM Inventory
GROUP BY InventoryTable.[ProductName]
HAVING (((InventoryTable.[AssetNumber])="pending"));
This gives an error saying that AssetNumber isn't part of the aggregate expression.
I've also tried it through the DesignView (below), but the error refers to a Datatype mismatch in the criteria.
I'm still trying to get an appreciation for the SQL language. I learn by cobbling examples together and playing with the individual peices.
Any insight is appreciated.
I'm trying to Group By ProductName, then Count the ProductNames that are still pending an AssetNumber.
InventoryTable
ProductName AssetNumber
ProductA pending
ProductA pending
ProductA pending
ProductB 1234
ProductB 1234
ProductC 5678
ProductC 5678
ProductD pending
ProductD pending
Question/Problem:
Count of ProductNames with AssetNumber equal to "pending" is : 2 . I'm having issues trying to get the count of 2. I'll later put this value in a text box. This is what I have tried so far (+20 variations).
SELECT InventoryTable.[ProductName], Count(*) AS Expr1
FROM Inventory
GROUP BY InventoryTable.[ProductName]
HAVING (((InventoryTable.[AssetNumber])="pending"));
This gives an error saying that AssetNumber isn't part of the aggregate expression.
I've also tried it through the DesignView (below), but the error refers to a Datatype mismatch in the criteria.
I'm still trying to get an appreciation for the SQL language. I learn by cobbling examples together and playing with the individual peices.
Any insight is appreciated.