I
ironicbionic
hi, table as follows:
ID DESC VALUE
======================
1 g56 7
1 j78 6
1 n67 1
1 7hh 1
2 3df 3
2 9kk 3
2 6gh 9
3 4hj 12
3 2vb 4
3 1ce 6
Trying to group by ID and show highest value, output below:
Id MaxOfvalue DESC
1 7 g56
2 9 6gh
3 12 4hj
easy enough without DESC -
SELECT Table1.Id, Max(Table1.value) AS MaxOfvalue
FROM Table1
GROUP BY Table1.Id;
but as soon as I add DESC on select line (even something desperate like
ucase(desc)) I get a message saying it's missing on the Group By line -
and as soon as I add it and run the query - I get all the records in
the table.
How do I overcome this please?
thank you.
ID DESC VALUE
======================
1 g56 7
1 j78 6
1 n67 1
1 7hh 1
2 3df 3
2 9kk 3
2 6gh 9
3 4hj 12
3 2vb 4
3 1ce 6
Trying to group by ID and show highest value, output below:
Id MaxOfvalue DESC
1 7 g56
2 9 6gh
3 12 4hj
easy enough without DESC -
SELECT Table1.Id, Max(Table1.value) AS MaxOfvalue
FROM Table1
GROUP BY Table1.Id;
but as soon as I add DESC on select line (even something desperate like
ucase(desc)) I get a message saying it's missing on the Group By line -
and as soon as I add it and run the query - I get all the records in
the table.
How do I overcome this please?
thank you.