php - query with less than and greater than statements in where clause -


select ( sum(r.marks_attained) / sum(r.total_marks) * 100 )as marks,        s.name   result r,        student s  r.student_id = s.student_id group  r.student_id ,  order  marks desc   

how can students marks percentage greater 90?

can use marks in clause?

try this:

select (sum(r.marks_attained)/sum(r.total_marks)*100)as marks,s.name result r ,student s r.student_id=s.student_id  group r.student_id  having (sum(r.marks_attained)/sum(r.total_marks)*100) >= 90 order marks desc 

i remove query , between , group by, added having clause

p.s: >= 90 (if want include 90, > 90 otherwise)


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -