俩条查询语句!! ( 积分: 50 )

  • 主题发起人 主题发起人 fl112900
  • 开始时间 开始时间
F

fl112900

Unregistered / Unconfirmed
GUEST, unregistred user!
oildata,soil,swat,to-daa074,cenghao 五个表!!
with adoquery1 do begin
sql.clear;
SQL.Add('SELECT oildata.井号, oildata.i, oildata.j, oildata.k,oildata.含水,soil.含油饱和度, swat.含水饱和度');
SQL.Add('from oildata inner join soil on soil.I=oildata.I and soil.J=oildata.J AND soil.K=oildata.K inner join swat ON swat.I=oildata.I AND swat.J=oildata.J AND swat.K=oildata.K where oildata.年月=''20011231''and swat.年月=''20011231'' and soil.年月=''20011231''');
open;
end;
with adoquery2 do begin
sql.clear;
SQL.Add('Select a.yczmc,a.yxhd,a.xch,b.k,b.井号,b.含水,c.cenghao,c.xuhao From to-daa074 a, 上面查询生成的临时表 b,cenghao c where b.井号=a.jh and a.yczmc=c.cenghao and b.k=c.xuhao');

open;
end;

这是俩条查询语句!!
我 想要俩个查询合在一起的结果!!(就是俩个select 后面的字段都有)
上面查询生成的临时表:我没有生成 应该如何写可以生成并且可以在下面用

如不生成临时表,应该如何;
 
with adoquery2 do begin
sql.clear;
SQL.Add('Select a.yczmc,a.yxhd,a.xch,b.k,b.井号,b.含水,c.cenghao,c.xuhao From to-daa074 a, (SELECT oildata.井号, oildata.i, oildata.j, oildata.k,oildata.含水,soil.含油饱和度, swat.含水饱和度 from oildata inner join soil on soil.I=oildata.I and soil.J=oildata.J AND soil.K=oildata.K inner join swat ON swat.I=oildata.I AND swat.J=oildata.J AND swat.K=oildata.K where oildata.年月=''20011231''and swat.年月=''20011231'' and soil.年月=''20011231''') b,cenghao c where b.井号=a.jh and a.yczmc=c.cenghao and b.k=c.xuhao');

open;
end;
 
我的是 dbf 表
这样写说有语法错误!!
 
后退
顶部