In my table 2 columns are there. Name
and Marks
. Something like this.
Name Marks
---------- -----------
AAA 50
BBB 48
CCC 54
AAA 52
DDD 55
BBB 60
AAA 66
I need to retrieve from the table something like below
Name No.of.attempts Max Mark
------- ---------------- ------------
AAA 3 66
BBB 2 60
CCC 1 54
DDD 1 55
You should do like:
select name,count(name) as no_of_attempts,max(marks)
from table_name
group by name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With