t1
uid1 uid2
1 2
t2
uid name
1 张三
2 李四
如何一条语句把t1表的两个字段在一条记录中翻译出来显示为
uid1_name uid2_name
张三 李四
7 个解决方案
#1
select b.name as uid1_name,c.name as uid2_name
from t1 a inner join t2 b
on a.uid1=b.uid
inner join t2 c
on a.uid2=c.uid
--这样可以么
from t1 a inner join t2 b
on a.uid1=b.uid
inner join t2 c
on a.uid2=c.uid
--这样可以么
#2
指向'from t1 a inner join t2 b' 中的inner,错误是
ORA-00933:SQL Command not properly ended.
高手再帮忙看看,我对SQL语句写的比较少,原来都写些简单的
ORA-00933:SQL Command not properly ended.
高手再帮忙看看,我对SQL语句写的比较少,原来都写些简单的
#3
select t_2.name as uid1_name, t2.name as uid2_name
from (select t2.name as name from t1,t2 where t1.uid1=t2.uid) t_2,t1,t2
where t1.uid2=t2.uid
from (select t2.name as name from t1,t2 where t1.uid1=t2.uid) t_2,t1,t2
where t1.uid2=t2.uid
#4
我只用过oracle9
用inner join 没有问题
用inner join 没有问题
#5
select b.name as uid1_name,c.name as uid2_name
from ti a , t2 b,t2 c
where a.uid1=b.uid
and on a.uid2=c.uid
from ti a , t2 b,t2 c
where a.uid1=b.uid
and on a.uid2=c.uid
#6
--上面多了一个on
select b.name as uid1_name,c.name as uid2_name
from ti a , t2 b,t2 c
where a.uid1=b.uid
and a.uid2=c.uid
select b.name as uid1_name,c.name as uid2_name
from ti a , t2 b,t2 c
where a.uid1=b.uid
and a.uid2=c.uid
#7
可以的,给分
#1
select b.name as uid1_name,c.name as uid2_name
from t1 a inner join t2 b
on a.uid1=b.uid
inner join t2 c
on a.uid2=c.uid
--这样可以么
from t1 a inner join t2 b
on a.uid1=b.uid
inner join t2 c
on a.uid2=c.uid
--这样可以么
#2
指向'from t1 a inner join t2 b' 中的inner,错误是
ORA-00933:SQL Command not properly ended.
高手再帮忙看看,我对SQL语句写的比较少,原来都写些简单的
ORA-00933:SQL Command not properly ended.
高手再帮忙看看,我对SQL语句写的比较少,原来都写些简单的
#3
select t_2.name as uid1_name, t2.name as uid2_name
from (select t2.name as name from t1,t2 where t1.uid1=t2.uid) t_2,t1,t2
where t1.uid2=t2.uid
from (select t2.name as name from t1,t2 where t1.uid1=t2.uid) t_2,t1,t2
where t1.uid2=t2.uid
#4
我只用过oracle9
用inner join 没有问题
用inner join 没有问题
#5
select b.name as uid1_name,c.name as uid2_name
from ti a , t2 b,t2 c
where a.uid1=b.uid
and on a.uid2=c.uid
from ti a , t2 b,t2 c
where a.uid1=b.uid
and on a.uid2=c.uid
#6
--上面多了一个on
select b.name as uid1_name,c.name as uid2_name
from ti a , t2 b,t2 c
where a.uid1=b.uid
and a.uid2=c.uid
select b.name as uid1_name,c.name as uid2_name
from ti a , t2 b,t2 c
where a.uid1=b.uid
and a.uid2=c.uid
#7
可以的,给分