Chinaunix首页 | 论坛 | 博客
  • 博客访问: 101766
  • 博文数量: 68
  • 博客积分: 2225
  • 博客等级: 大尉
  • 技术积分: 775
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-21 12:36
文章分类

全部博文(68)

文章存档

2011年(42)

2010年(26)

我的朋友

分类: 数据库开发技术

2011-04-14 11:23:35

简单举例一下:
A表
id  name
1    a
2    b
3    c
4    d
___________________________________________
B表
id   name
3     e
4     f
5     g
左联:select A.*,B.* from A left join B on A.id=B.id
显示结果:
id  name id  name
1    a   null  null
2    b   null  null
3    c   3    e
4    d   4    f

右联:select A.*,B.* from A right join B on A.id=B.id

显示结果:
id  name id  name
3   e     3   e
4   f     4   f
null null 5   g

全联:select A.*,B.* from A full join B on A.id=B.id

id  name id  name
1    a   null  null
2    b   null  null
3    c   3    e
4    d   4    f
5    null 5    g
_________________________________________________________________________________






阅读(397) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~