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.idOf开发者_JS百科fer = 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 ?
Since your SQL "as b" columnResult is based specifically on a SQL, and the WHERE clause of the of the idOffer already qualifies and SHOULD be the same, I would remove the group by of this columnar element. I can only assume there might be some white-space data or other that is falsely getting included and "ID1" is different than "ID1 " is getting falsely interpretted.
No idea if this has anything to do with it, but Linux MySQL tables are case sensitive while Windows tables are not (because of the filesystem, I suspect), anyway, you have Product
and product
and that will cause some problems.
Don't know if it really is the cause of the problem in your question, but it is a wall you may end up flying smack into and I thought it should be brought up.
精彩评论