Greencoffee
Programmer
I have different quantities of product in different bins. Ultimatley I need to display the bin with the least amount of product. The quantity of product 'X' in a particular bin will be summed. So it will look like this:
Bin Prod QOH
A1 X 15 <--this is computed in the query using sum()
A2 X 26
A3 X 8
A4 X 124
B1 X 1
B2 X 69
B3 X 37
C1 X 88
Now I need to display Bin B1 because it has 1 unit of product.
I thought I would be able to use MIN(SUM()), but this is not valid. I'm currently using MIN() with a nested select that uses the SUM() function. But does anyone know a better way to do this?
Bin Prod QOH
A1 X 15 <--this is computed in the query using sum()
A2 X 26
A3 X 8
A4 X 124
B1 X 1
B2 X 69
B3 X 37
C1 X 88
Now I need to display Bin B1 because it has 1 unit of product.
I thought I would be able to use MIN(SUM()), but this is not valid. I'm currently using MIN() with a nested select that uses the SUM() function. But does anyone know a better way to do this?