php - MySQL Query for " Where SUM(Price) Bigger Than Equal " ? -


this query :

select user,name,sum(price) $tablename faktor='1' group user order sum(price) asc 

this query work , want show have sum(price) bigger 100 $ . test where sum(price) < '100' not work , , result wrong.

thanks ;)

you need use having, not where.

select user,name,sum(price)   $tablename   faktor='1'   group user   having sum(price) < 100   order sum(price) asc 

where applies before doing group-by. having applies afterwords.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -