求一3表查询的SQL语句

[复制链接]
查看11 | 回复3 | 2010-5-13 22:25:47 | 显示全部楼层 |阅读模式
select sh_bind.id,sh_bindmsg.name,sh_type.name from sh_bind, sh_bindmsg, sh_type where sh_bind.bid = sh_bindmsg.id and sh_bind.tid = sh_type.id包行的 你自己看看是不是表名或是字段名写错了
回复

使用道具 举报

千问 | 2010-5-13 22:25:47 | 显示全部楼层
select a.id,b.name,c.namefrom sh_bind a inner join sh_bindmsg bon a.bid = b.idinner join sh_type con a.tid = c.id =========如果简单表连接,这里很多答案都对问题是你需要的最终效果是什么
回复

使用道具 举报

千问 | 2010-5-13 22:25:47 | 显示全部楼层
select sh_bind.id,sh_bindmsg.name,sh_type.name from sh_bind, sh_bindmsg, sh_type where sh_bind.bid = sh_bindmsg.id and sh_bind.tid = sh_type.id通过主外键关系关联的各表可以进行多表联合查询
回复

使用道具 举报

千问 | 2010-5-13 22:25:47 | 显示全部楼层
select sh_bind.id,sh_bindmsg.name,sh_type.name from sh_bind, sh_bindmsg, sh_type where sh_bind.bid = sh_bindmsg.id and sh_bind.tid = sh_type.id
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行