同时查询3张不太一样的表,
table1:
id
name
sex
fax
file
email(不同)
-----------
table2:
id
name
sex
fax
file
phone(不同)
-----------
table3:
id
name
sex
fax
file
address(不同)
把name sex fax file 读出来,但是并把他们的记录 写入1.txt 2.txt 3.txt中;
当然这样比较变态,我可以分别读取,然后在分别写.问题是我想把他们union 起来,让后rs.movenext.可以吗?
------解决方案--------------------三张表有关联的字段吗
------解决方案--------------------why有这么2的三个表?
------解决方案--------------------没看懂.
可用ID连接吗?
select tb1.* , tb2.phone, tb3.address from tb1
full join tb2 on tb1.id = tb2.id
full join tb3 on tb1.id = tb3.id
------解决方案--------------------不明白你是什么意思
select name, sex, fax, file, '1 ' as tabname, email as difcol from table1
union
select name, sex, fax, file, '2 ' as tabname, phone as difcol from table2
union
select name, sex, fax, file, '3 ' as tabname, address as difcol from table3
你生成的联合表中你对tabname字段进行判定,根据值记到文本N中