From: Mary Phelps on
I have a table TempInventory with 2 fields Id, Inventory. I would like
to grab all distinct Id's and the minmum inventory for thse Id's. What
is the sql query to get such data. The data looks something like this:
Id Inventory
28386 32
28386 52
28386 59
28386 68
28387 52
28387 83
28387 85
28387 178
28387 200
28387 213
28388 89
28388 110
28388 174
28388 200
28388 212
28388 259
28388 313
28389 110
28389 200
28389 212
28389 313
28389 421
28389 565
From: Bob McClellan on
Hi Mary...
this should do it...

select id, Min(Inventory)
From TempInventory
group by id
order by ...

"Mary Phelps" <icanhelp33(a)gmail.com> wrote in message
news:5f2bbfa1-2b8d-47d5-8c0c-b4663b4d14bb(a)a17g2000pre.googlegroups.com...
>I have a table TempInventory with 2 fields Id, Inventory. I would like
> to grab all distinct Id's and the minmum inventory for thse Id's. What
> is the sql query to get such data. The data looks something like this:
> Id Inventory
> 28386 32
> 28386 52
> 28386 59
> 28386 68
> 28387 52
> 28387 83
> 28387 85
> 28387 178
> 28387 200
> 28387 213
> 28388 89
> 28388 110
> 28388 174
> 28388 200
> 28388 212
> 28388 259
> 28388 313
> 28389 110
> 28389 200
> 28389 212
> 28389 313
> 28389 421
> 28389 565