Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trivial err in sql statement

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

I would like to add another 'filter' to the statement below:

//this works
SELECT PD.ID, SUM(PD.amount) AS payment_total
FROM paymentDon AS PD
GROUP BY ID

when adding this: WHERE PD.payment_total>90

in
SELECT PD.ID, SUM(PD.amount) AS payment_total
FROM paymentDon AS PD
WHERE PD.payment_total>90
GROUP BY ID

I get an error message - anyone?
 
stu derby
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this (it may not work on all databases):

SELECT PD.ID, SUM(PD.amount) AS payment_total
FROM paymentDon AS PD
GROUP BY ID
HAVING SUM(PD.amount) > 90
 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YES! thanks you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic