Hi Richard,
Richard Reina wrote:
I have a database table paycheck like this. empno, date, gross, fed_with 1234 "2007-09-01" 1153.85 108.26 1323 "2007-09-01" 461.54 83.08 1289 "2007-09-01" 1153.85 94.41 1234 "2007-09-15" 1153.85 108.26 1323 "2007-09-15" 491.94 87.18 1289 "2007-09-15" 1153.85 94.41 I can easily do a query like this select (SUM(gross) * .153) + SUM(fed_with) FROM paycheck where DATE="2007-09-01"; But then I have to do a query for each pay date in the pay period. Accordingly, what would be really useful on a day like today would be to be able to do a query like the following: select (SUM(gross) * .153) + SUM(fed_with) FROM paycheck where DATE IS distinct; Does anyone know how to do this?
it seems you want to use "group by": SELECT (SUM(gross) * .153) + SUM(fed_with) FROM paycheck GROUP BY date; See here: http://dev.mysql.com/doc/refman/5.0/en/select.html http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html HTH, Joerg -- Joerg Bruehe, Senior Production Engineer MySQL AB, www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]