这样的SQL语句怎样写, 是否非要分两步?
adoqry1.close; adoqry1.sql.clear;
adoqry1.sql.text := 'select A.field1, B.field2 from tabel1 as A, table2
as B where A.id = B.id';
adoqry1.open;
while not adoqry1.eof do begin //然后以返回的结果集去捞table3.field3:
adoqry2.close; adoqry2.sql.clear;
adoqry2.sql.text := 'select field3 from table3 '
+ ' where field1 = '+ quotedstr(adoqry1.fields[0])
+ ' and field2 = ' + quotedstr(adoqry1.fields[1]);
adoqry2.open;
adoqry1.next;
end;
请问以上的解决方法能否用一句SQL语句搞定, 将table1.field1, table2.field2,
table3.field3以一个结果集返回, 类似这样: select A.field1, B.field2,
C.field3 from table1 as A, table2 as B, table3 as C where ..........
帮帮忙!
Ths!