我必须在demo.brandname表的demo1列中更新brandname 并从演示
中选择查询update my.demo1
inner join
(
select sku,brandname,product
from
(
select sku,product,brandname,count(brandname) as counter
from
(
select sku,product,brandname
from my.demo
where brandname is not null
) as derive
group by sku,product,brandname
order by counter desc
) as derive1
group by sku,product
) as ai on sku=ai.sku set brandname=ai.brandname;
答案 0 :(得分:0)
如果从Workbench调用SQL,则添加
use <YOUR DATABASE NAME>;
SQL之前的。
如果从java调用它,请检查如何在连接URL中指定数据库名称