mysql 两列交叉取值查询

mysql 两列交叉取值查询,第1张

交叉比对并且取每个字段的时间最晚的:

select a.id,a.xxa,b.mes from (select * from( select * from test order by time desc) a group by xxa,mes) a cross join (select * from ( select * from test order by time desc) b group by xxa,mes) b

update A a, (select min(c.pic) as pic, b.goods_id as goods_id from B b, C c where b.cat_id=c.cat_id GROUP BY b.goods_id) bc set a.pic = bc.pic where a.goods_id=bc.goods_id

索引随便加吧,主键都加


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/8501071.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-17
下一篇 2023-04-17

发表评论

登录后才能评论

评论列表(0条)

保存