MySQL different versions other results.

Posted by kuba on Stack Overflow See other posts from Stack Overflow or by kuba
Published on 2010-05-17T10:01:06Z Indexed on 2010/05/17 10:10 UTC
Read the original article Hit count: 230

Filed under:

hey, i have 2 version of mysql on windows 5.1.39-community and on linux 5.1.39-log i execute a query:

SELECT `o`.`idOffer`, 

       `o`.`offer_date`, 
       `p`.`factory`, 
       `c`.`short` AS `company`, 
       `s`.`name` AS `subcategory`, 
       `ct`.`name` AS `category`,
       count( (select count(1) from product where idProduct=idOffer group by idOffer) ) as b
 FROM `Offer` AS `o` 
 LEFT JOIN `Product` AS `p` ON o.idOffer = p.idOffer 
 LEFT JOIN `company` AS `c` ON o.company = c.id 
 LEFT JOIN `Subcategory` AS `s` ON s.idSubcategory = o.idSubcategory 
 LEFT JOIN `Category` AS `ct` ON ct.idCategory = s.idCategory 
 WHERE (o.idOffer = p.idOffer) GROUP BY `o`.`idOffer`

on windows it works as it suppose, but on linux it says:

ERROR 1242 (21000): Subquery returns more than 1 row

is it any way to get it worked on linux without any mysql updates/downgrades ?

© Stack Overflow or respective owner

Related posts about mysql-query