F fqyyong Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-08 #1 比如有一个mdb文件,其中包含两张表table1,table2,他们中都包含字段‘姓别’, 我想查询出两张表中所有性别为'女'的纪录,并将结果显示在一个dbgrid中,请问 该怎么办?
A aijun Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-08 #2 with dbgrid.DataSet do begin close; sql.clear; sql.add('select a.*,b.* From table1 a,table2 b where (a.姓别=b.姓别) and (a.姓别='女')'); Open; end;
with dbgrid.DataSet do begin close; sql.clear; sql.add('select a.*,b.* From table1 a,table2 b where (a.姓别=b.姓别) and (a.姓别='女')'); Open; end;
M MichaelZhu Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-08 #3 select [fields] from table1 where 姓别='女' union select [fields] from table2 where 姓别='女'
T twos Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-08 #4 对,使用Union Union就是干这活的,只要两个结果集的结构想同
F fqyyong Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-08 #6 成了,谢谢大家 对了aijun,你说的那个好像是连接查询呀,另外dbgrid好像没有dataset这个属性