Well it all depends which version of mysql you are using... versions prior to 4 don't support sub-select..
---------- "Stijn Van Rompaey" <[EMAIL PROTECTED]> writes: Return-Path: <[EMAIL PROTECTED]> Received: from mx11.nyc.untd.com (mx11.nyc.untd.com [10.140.24.71]) by maildeliver03.nyc.untd.com with SMTP id AAA9DDMXAABM9SBJ for <[EMAIL PROTECTED]> (sender <[EMAIL PROTECTED]>); Fri, 24 Jan 2003 16:22:40 -0500 (EST) Received: from web.mysql.com (web.mysql.com [213.136.49.183]) by mx11.nyc.untd.com with SMTP id AAA9DDMW9AUWDGJA for <[EMAIL PROTECTED]> (sender <[EMAIL PROTECTED]>); Fri, 24 Jan 2003 16:22:39 -0500 (EST) Received: (qmail 27937 invoked by uid 7797); 24 Jan 2003 15:18:00 -0000 Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm (http://www.ezmlm.org) List-ID: <mysql.mysql.com> Precedence: bulk List-Help: <mailto:[EMAIL PROTECTED]> List-Unsubscribe: <mailto:[EMAIL PROTECTED]> List-Post: <mailto:[EMAIL PROTECTED]> List-Subscribe: <mailto:[EMAIL PROTECTED]> Delivered-To: mailing list [EMAIL PROTECTED] Received: (qmail 27923 invoked from network); 24 Jan 2003 15:18:00 -0000 Message-ID: <00b601c2c3bb$cae633a0$c031e0d5@testrk98> From: "Stijn Van Rompaey" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Subject: count in subselect problem Date: Fri, 24 Jan 2003 16:18:04 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 1st problem: SELECT F.id, F.title, F.description, F.created, (select count(*) from forum F, topic T where F.id=T.forum_id AND T.reply_id=0 ) count1, (select count(*) from forum F, topic T where F.id=T.forum_id ) count2 from forum F, topic T where F.id=T.forum_id AND T.reply_id=0 GROUP BY F.id 2nd problem: SELECT T.title, T.id, P.nick, (select count(*) from topic where reply_id = T.reply_id) replies FROM topic T, profile P WHERE T.author_id=P.id AND T.forum_id=1 and reply_id=0; what is wrong with these queries? --------------------------------------------------------------------- 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 --------------------------------------------------------------------- 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