This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes trivial err in sql statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "trivial err in sql statement" Watch "trivial err in sql statement" New topic
Author

trivial err in sql statement

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
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

Joined: Dec 15, 2005
Posts: 333
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

Joined: Sep 10, 2004
Posts: 755
YES! thanks you
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trivial err in sql statement