The idea is to find the Min `Inventory` value for each `Tank` for a specified `Site Number` not the single lowest inventory value for a specific `Site Number`
Code:
SELECT DISINCT `Tank`
FROM `detail`
WHERE `Site Number` = 9201906000;
Returns:
|Tank
|-----
|1
|2
|3
|-----
Code:
SELECT `Tank`, `Grade`, Min(`Inventory`) as 'Min Inventory'
FROM `detail`
WHERE `Site Number`= 9201906000 and `Tank` = *Variable Criteria*;
Desired Result: is attached as image
The Field named `Tank` contains a simple 1, 2, 3, or 4 value that identifies the tank.
All fields are located in the same table. I can do this w/ VBScript, but I'm sure there has to be a way using only SQL.