多表连接问题?

primulaling 2008-01-18 11:27:07
表1
term_id term_name
1 a
2 b
3 c

表2
term_term_id term_name term_association
1 a 一
2 c 二
3 b 三

表3
object_id object_association term_association
1 张三 二
2 李四 一
3 王五 三

....还有几个表其中两两表中之间均有一个相同的字段名

最后的结果:
id object_assaction term_name term_association
1 张三 c 二
2 李四 a 一
3 王五 b 三
...全文
39 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
primulaling 2008-01-18
  • 打赏
  • 举报
回复
多谢,刚接触还不太会。准备假期好好看看。
narsh 2008-01-18
  • 打赏
  • 举报
回复
select id,object_assaction,term_name,term_association
from 表1,表2,表3
where 表1.term_id=表2.term_term_id
and 表2.term_term_id=表3.id


--就是表连接,好好看看帮助

34,838

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧