David Garamond <[EMAIL PROTECTED]> wrote:

CREATE TABLE `payments` (
   `date` date NOT NULL,
   `payee` varchar(255),
   `amount` double
)

The 'payments' table records the amount of money that should be paid to each person every month. But the actual cheque is only given when the total accumulated amount has reached $50 or more for that person.

I want to list the amount of money that needs to be paid by cheques.

Can I do this with in pure SQL (instead of having to create logic in
programming language)?

SELECT payee, amount FROM payments GROUP BY payee HAVING amount > 49.995

Beware using 'double' for currency; it gives roundoff errors.

Bruce Feist



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to