Groups | Blog | Home
all groups > dotnet ado.net > march 2007 >

dotnet ado.net : SELECT query


Lubomir
3/30/2007 4:08:01 PM
Hi,

I have a table:
column: A | B
----------------
row: a | 1
a | 2
c | 2
c | 3

I need to get from this table all "distinct" records with maximum value in B
for particular value in A
So in this case I need the result will have 2 rows: a|2, C|3
I tried to make some subqueries, but always I anded up with the only row C|3
what was wrong.

Any idea how to do it?

Thanks,

Kerry Moorman
3/30/2007 7:20:00 PM
Lubomir,

Can't you do

Select a, max(b) Group By a

Kerry Moorman


[quoted text, click to view]
AddThis Social Bookmark Button