select hw.* from hgdb.wjzj_shixiao w
inner join hgadb.cd_well_source c
on c.well_desc = w.jh
inner join hgadb.wjzj_shixiao hw
on hw.jh = c.well_common_name and hw.wgrq = w.wgrq这条sql能用where搞定吗
inner join hgadb.cd_well_source c
on c.well_desc = w.jh
inner join hgadb.wjzj_shixiao hw
on hw.jh = c.well_common_name and hw.wgrq = w.wgrq这条sql能用where搞定吗
select hw.* from hgdb.wjzj_shixiao w ,hgadb.cd_well_source c, hgadb.wjzj_shixiao hw
where hw.jh = c.well_common_name and hw.wgrq = w.wgrq and c.well_desc = w.jh
from hgdb.wjzj_shixiao w,hgadb.cd_well_source c,hgadb.wjzj_shixiao hw
where c.well_desc = w.jh
and hw.jh = c.well_common_name
and hw.wgrq = w.wgrq;
from hgdb.wjzj_shixiao w ,hgadb.cd_well_source c,hgadb.wjzj_shixiao hw
where c.well_desc = w.jh
and c.well_common_name and hw.wgrq = w.wgrq?
--是这个意思吗?
select hw.*
from hgadb.wjzj_shixiao hw,hgdb.wjzj_shixiao w,hgadb.cd_well_source c
where hw.jh = c.well_common_name
and hw.wgrq = w.wgrq
and c.well_desc = w.jh
inner join的表名放到from 后面,on的条件放到where后面.
后面只允许有一个表
select hw.* from hgadb.wjzj_shixiao hw where hw.jh in (select c.well_common_name from hgdb.wjzj_shixiao w inner join hgadb.cd_well_source c on c.well_desc = w.jh)
我做成这样 但还少个字段怎么加呢