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
Post a Comment