这个SQL语句告诉我组附近有错误... 它适用于select * from和no set。任何想法?
UPDATE orders o
JOIN (select i.oid, i.pid from items i where i.pid <> '4970' ) i ON o.oid= i.oid
JOIN products p ON i.pid = p.product_id
SET o.sortloc = concat('zzz',p.location)
where (o.stat = '4' OR o.stat = '0' OR o.stat = '20' )
group by o.oid
having count(*) > 1
答案 0 :(得分:0)
通过将计数*更改为内部选择来解决。
UPDATE
orders o
JOIN (select i.oid, i.pid, count(*) as ocnt from items i where i.pid <> '4970' group by i.oid) i ON o.oid= i.oid
JOIN products p ON i.pid = p.product_id
SET o.sortloc = concat('zzz',p.location)
where (o.stat = '4' OR o.stat = '0' OR o.stat = '20' ) and i.ocnt > 1
答案 1 :(得分:0)