临时表更新数据

CREATE TEMPORARY TABLE tmp_tableA
select min(trendId) as trendId,
goodsId
from `goodsRelationTrend`
group by goodsId;

SELECT * FROM tmp_tableA;

CREATE TEMPORARY TABLE tmp_tableB
select min(trendImageId),
trendImage.*,
tmp_tableA.goodsId
from tmp_tableA,
trendImage
where tmp_tableA.trendId= trendImage.trendId
group by trendImage.trendId

select *  from tmp_tableB ORDER BY goodsId asc

update goods
inner join tmp_tableB on goods.goodsId= tmp_tableB.goodsId
and char_length(tmp_tableB.url)> 10 and goods.cover =”
set goods.cover= tmp_tableB.url


发表评论

电子邮件地址不会被公开。 必填项已用*标注