mysql - Selecting a particular row when grouping data -
this question has answer here:
- sql select rows max value on column 26 answers
studentid questionid incorrect unanswered flagged pace id subtopicid ========================================================================== 1 1 1 0 0 2 1 1 1 1 0 0 0 4 2 1 1 2 0 0 0 8 3 1 i have table above values in it. want select the questions attempted student particular subtopic once. in case there multiple entries question want select 1 greater id. couldn't figure out way select question greater id. trying.
select questionid , pace , id table studentid = 1 , subtopicid = 1 group questionid order id desc; can please tell me modifications in query or suggest new one?
can please try:
select questionid, max(id) maxid table studentid = 1 , subtopicid = 1 group questionid order id desc
Comments
Post a Comment