@jlrdw I found the solution
SELECT SUM(mark),student_username FROM exams WHERE exam_type='FINAL' GROUP BY student_username HAVING MIN(mark) >= 50
but how can I write it in laravel eloquent standard ? I'm getting error when i put min caluse in having function?
Thank you @nakov it works finally. also thank you to @jlrdw for your much effort.
@nakov funny that havingRaw would work since the clause there was not an aggregate but a direct mark.
By all right having should have worked.
One of the reasons I usually just use straight PDO.
In Having clause you can pass conditions for group by field only, (Having is a condition on group by clause result) so if you want to ignore failed student you have to add conditions of each subject in where clause.
Please add where clause for each subject>40
I hope you get this.
Please sign in or create an account to participate in this conversation.