mysql多表添加查询

[复制链接]
查看11 | 回复4 | 2011-2-15 19:46:00 | 显示全部楼层 |阅读模式
给你几个情况1.如果是累加name是这样的update bset name=name+a.namefrom awhere a.url=b.http 2.直接插入insert b(name)select namefrom a join b on a.url=b.http 3.替换原来的nameupdate bset name=a.namefrom awhere a.url=b.http...
回复

使用道具 举报

千问 | 2011-2-15 19:46:00 | 显示全部楼层
你想查询什么? 补充:select g_article.a_title as title from t_article a where a.a_adder=“管理员” union select g_picture.p_title as title from t_picture b where b.p_adder=“管理员” union...
回复

使用道具 举报

千问 | 2011-2-15 19:46:00 | 显示全部楼层
应该用更新语句,记录不会增加。update a set a.name=b.name from b where a.url=b.http...
回复

使用道具 举报

千问 | 2011-2-15 19:46:00 | 显示全部楼层
可以将2句连接起来,即insert into a (name) select name from b where a.url=b.http...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行