在线等待--查询两张表的同一字段的所有值 select A.*,B.*from table1 A full join table2 B on B.id=A.id 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select a.id from table1 a where exists(select 1 from table2 where id=a.id) to progress99(如履薄冰)我想把两张表中的Id 放在一个字段中显示 樓主是隻要id字段嗎?select A.idfrom table1 A inner join table2 B on B.id=A.id 用內聯接:select A.id,A.name,B.addressfrom table1 A inner join table2 B on B.id=A.id select a.id from table1 a inner join table2 b on a.id = b.id to zjcxc(: 邹建 :) 我想把两张表中的Id 放在一个字段中显示 to progress99(如履薄冰)是的只要ID,要两张表中ID的所有值 select a.id from table1 a inner join table2 b on a.id=b.id 這樣就可以了:select A.idfrom table1 A inner join table2 B on B.id=A.id to progress99(如履薄冰)select A.id,A.name,B.addressfrom table1 A inner join table2 B on B.id=A.id这样只能得到两张表中想同的ID 內聯接參保証到兩表的id相同時才select 出來。 to shuichangliu(生活一定会越来越好!)select a.id from table1 a inner join table2 b on a.id=b.id不能得到所有的ID to progress99(如履薄冰) 我想取出所有的,包括相同的和不同的 還是要笛卡爾積:select distinct A.idfrom table1 ,table2 就用這個,你先試試select distinct A.idfrom table1 ,table2 to progress99(如履薄冰)笛卡爾積不能得出ID的所有值 --原来搞错你的意思,你是想将两张表中所有的ID取出来,而且不重复,是否这个意思?select id from table1unionselect id from table2 懂了,你是要這個:select idfrom table1union select idfrom table2 to zjcxc(: 邹建 :) 是的 to progress99(如履薄冰) zjcxc(: 邹建 :) 谢谢 MSSQL两表连接.求高手 SQL检查约束问题! 这个3表连接有错吗?高手帮帮忙! 请问,网上哪里有sqlserver2000运行机制的资料,比如说,数据是怎么样插入,怎么样执行查询之类的 在语句中这样执行存储过程可以吗? 再次求助连续登陆天数问题? 不知道如何学习sql server 啊? 高手介绍一哈书啊 请教,在用powerdesigner建模时,怎么设置该日期列自动取得系统当前日期 数字型问题 高手请进:为何无法在视图上创建索引?? telnet 10.33.25.24 1433 不能连上,怎么解决? 读取表中N条记录,N可变!我写的存储过程如下,请问高手错在那里???
我想把两张表中的Id 放在一个字段中显示
select A.id
from table1 A inner join table2 B on B.id=A.id
select A.id,A.name,B.address
from table1 A inner join table2 B on B.id=A.id
我想把两张表中的Id 放在一个字段中显示
是的只要ID,要两张表中ID的所有值
select a.id from table1 a inner join table2 b on a.id=b.id
select A.id
from table1 A inner join table2 B on B.id=A.id
select A.id,A.name,B.address
from table1 A inner join table2 B on B.id=A.id
这样只能得到两张表中想同的ID
select a.id from table1 a inner join table2 b on a.id=b.id
不能得到所有的ID
我想取出所有的,包括相同的和不同的
select distinct A.id
from table1 ,table2
select distinct A.id
from table1 ,table2
笛卡爾積不能得出ID的所有值
union
select id from table2
from table1
union
select id
from table2
是的
谢谢