At 12:40 -0400 7/18/03, John Larsen wrote:
Does anybody know if there is a way to aggregate a table then join it to another table?
I assume this would be possible with a subquery as in
SELECT * FROM t1 WHERE t1.a=(SELECT sum(t2.b) FROM t2 group by t2.c);


Except when I do it with 4.1alpha I get error "[root] ERROR 1240: Subselect returns more than 1 record"
I though that was the whole point of a subselect is that you got more than 1 record

Not all subselects. The "=" subselect must return a single value. You may want to use IN instead, which allows a column of values.


-- Paul DuBois, Senior Technical Writer Madison, Wisconsin, USA MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


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



Reply via email to