Good day everyone, I have a table in of this format in MySQL database:
| sdtId | clsId | subjId | mark | pos |
|---|---|---|---|---|
| 1 | 2 | 1 | 65 | |
| 2 | 1 | 3 | 45 | |
| 1 | 2 | 2 | 60 | |
| 2 | 2 | 1 | 65 | |
| 2 | 1 | 3 | 39 | |
What I want to do is, I want to determine the position of students per subject per class by getting the highest score per a particular subject per class. Because student in class 1 can still be offering subject 2 as student in class 2 . After getting the position, I will now update the position columns accordingly maybe using a while loop.
Please is this achieveabl using SQL and PHP?