读书人

这样的sql联接语句如何写

发布时间: 2012-01-02 22:40:04 作者: rapoo

这样的sql联接语句怎么写?
select laowu.name,sb_feerecord.ygid,sb_feerecord.Sb_Month,
Sb_YanLao_Unit,Sb_LosJob_Unit,gzjb_ID_Unit
from laowu,sb_feerecord,gzjb
where laowu.id=sb_feerecord.ygid
and laowu.id=gzjb.ygid
and gzjb.id=sb_feerecord.gzjb_ID_Unit

select laowu.name,sb_feerecord.ygid,sb_feerecord.Sb_Month,
Sb_YanLao_Per,Sb_Medcal_Per,gzjb_ID_Personl
from laowu,sb_feerecord,gzjb
where laowu.id=sb_feerecord.ygid
and laowu.id=gzjb.ygid
and gzjb.id=sb_feerecord.gzjb_ID_personl

查询出的这个两个表如果要用两个表的ygid关联,应该怎么写.

[解决办法]
select * from
(第一句)aa
Inner Join
(第二句)bb
On aa.ygid=bb.ygid

读书人网 >SQL Server

热点推荐