0

I have a table:

(id , s_id  , degree , cid)

cid mean class id. I want select max 3 degrees for every class. I tried:

select s_id,MAX(degree),cid from std_degree GROUP BY cid,degree

but it didn't work.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
  • where's your code ? – Soltius Apr 18 '17 at 09:31
  • If none of the options in the duplicate link work for you, drop a comment explaining where you got stuck and this can be reopened. – Tim Biegeleisen Apr 18 '17 at 09:34
  • thank for your help i fixed it my code: $query = mysqli_query($conn," select s_id, cid, degree from std_degree where cid in(SELECT cid FROM std_degree group by cid) order by degree desc limit 9 "); – Eng Waleed Apr 18 '17 at 12:22

0 Answers0