嘿,我在 windows 5.1.39-community 和 linux 5.1.39-log 上有 2 个版本的 mysql,我执行一个查询:
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`
在 Windows 上它可以正常工作,但在 linux 上它说:
ERROR 1242 (21000): Subquery returns more than 1 row
有没有办法让它在没有任何 mysql 更新/降级的情况下在 linux 上运行?