MySQL Forums
Forum List  »  Newbie

Re: Problem with COUNT in the statement JOIN
Posted by: Chevy Mark Sunderland
Date: February 27, 2012 08:12PM

thanks a lot.

I need group by region, I try this statement but I have error:

[SQL]  SELECT ( 
      (SELECT cast( COUNT(*) as decimal(10,8))
      FROM myfirsttablemysql
      WHERE (YEAR(`myDatesYYYYMMDD`)='2011')
GROUP BY region
   )  
   /
   ( 
        SELECT cast( SUM( hour_1 + hour_2) as decimal(10,0) )
        FROM mysecondtablemysql
        WHERE years = 2011
GROUP BY region
   ) * 960.7)*1000 As result
;
[Err] 1242 - Subquery returns more than 1 row



Edited 1 time(s). Last edit at 02/27/2012 08:29PM by Chevy Mark Sunderland.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.