简单SQL语句问题

[复制链接]
查看11 | 回复3 | 2008-5-6 11:21:29 | 显示全部楼层 |阅读模式
select * from
ychis.if_feeitemlist t,ychis.r_department a,ychis.r_employee b,ychis.undrug_zt c
where t.dept_code = a.dept_code
and t.doct_code = b.empl_code
and t.zt_code = c.zt_code

现在选出的记录条件是 t.doct_code = b.empl_code 但是t.doce_code = null的时候记录就取不出来
如何写能出现即使t.doct_code = null 的时候也把相应的记录取出来。
回复

使用道具 举报

千问 | 2008-5-6 11:21:29 | 显示全部楼层
select * from
ychis.if_feeitemlist t,ychis.r_department a,ychis.r_employee b,ychis.undrug_zt c
where t.dept_code = a.dept_code
and t.doct_code= b.empl_code(+)
and t.zt_code = c.zt_code
回复

使用道具 举报

千问 | 2008-5-6 11:21:29 | 显示全部楼层
外部连接的问题。
回复

使用道具 举报

千问 | 2008-5-6 11:21:29 | 显示全部楼层
最初由 ggf0626 发布
[B]select * from
ychis.if_feeitemlist t,ychis.r_department a,ychis.r_employee b,ychis.undrug_zt c
where t.dept_code = a.dept_code
and t.doct_code= b.empl_code(+)
and t.zt_code = c.zt_code [/B]

好帖 能讲一讲+的使用么 之前遇到过连接 可没怎么弄明白 谢谢!
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行