是left out join(左外连接)
不是left jion
从你的表达式来看应该是用 right out join
这些是SQL7.0的用法,2000的话应该可以是table1.column=table2.*.
不是left jion
从你的表达式来看应该是用 right out join
这些是SQL7.0的用法,2000的话应该可以是table1.column=table2.*.
解决方案 »
- 向表中插入日期,怎么出错了啊?
- sqlprofiler跟出来的sql为何有重复?
- 如何将这两个语句select 合为一个select 语句
- 实时数据表查询问题
- 一个表的修改问题
- 我以前用的SQL2000开发的软件,现在想改MSDE,如何连上数据库呢(在MSDE附加数据)
- 行---列 转换 是牛人的就来挑战一下.
- NTService程序访问SQL Server的怪异问题
- 求MIS系统文档——从需求分析到详细设计都要,急!!!!
- 紧急!!!!怎样在存储过程A里面调用存储过程B??
- sqlserver的输出,print、return还有select他们之间有什么区别啊?
- 如何写SQL:手机表中编号、型号、品牌三个字段,要求保存时同品牌、同型号的手机的编号自动加1保存
Select show_id1,B.b_name,show_id2,C.b_name from t_a A
Left Join t_b B On A.show_id1=B.b_id
Left Join t_b C On A.show_id2=C.b_id
show_id1 show_id2
1 4
3 3
4 2
2
...
b表中
b_id b_name
1 aaa
2 bbb
3 ccc
4 ddd
...
10 mmm
...
我想查出结果是
aaa ddd
ccc ccc
ddd bbb
bbb
create table 表1 (show_id1 varchar(10),
show_id2 varchar(10))go insert into 表1 (show_id1,show_id2) select '1','4'
union all select '3','3'
union all select '4','2'
union all select '','2'
create table 表2 (b_id varchar(10),
b_name varchar(10))goinsert into 表2 (b_id,b_name) select '1','aaa'
union all select '2','bbb'
union all select '3','ccc'
union all select '4','ddd'go
select xx=(select b.b_name from 表2 b where a.show_id1=b.b_id),cc=(select c.b_name from 表2 c where a.show_id2=c.b_id) from 表1 a