RE: Search WHERE SUM

2003-07-28 Thread Jay Blanchard
[snip] SELECT id FROM sales WHERE SUM( totalsales) <= '2' GROUP BY id; [/snip] SELECT id, SUM(totalsales) AS TotalSales FROM sales GROUP BY id HAVING TotalSales <= '2' HTH! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql

RE: Search WHERE SUM

2003-07-28 Thread Kevin Fries
Easy: SELECT id FROM sales GROUP BY id HAVING SUM( totalsales) <= 2 ; That will perform the grouping, by ID, then filter and display only calculated rows with a sum less than 2. > -Original Message- > From: Yoed Anis [mailto:[EMAIL PROTECTED] > Sent: Monday, July 28, 2003 10:22