<snip> > not a sum of all of the firsts. What I do want is a sum of > all of the numbers in column 5 where the date is after a > certain date, column 3 has "done" in it, and the url matches > a regular expression mysql. > > How do I do that?
SELECT SUM(column5) FROM readdata WHERE processdate > '2002-8-31' AND column3 = 'done' AND url REGEXP 'mysql'; Don't include column5 in your query. SUM() summarises a group of data by adding up its totals. If you include column5 outside SUM() in your query you are breaking up your results into one entry for each entry that matches the conditions of the WHERE statement. SUM is still doing its job correctly, but will only be adding together 1 number, which is why SUM(column5) = column5. Does that make sense?? L. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php