表1id name value 001 test1 100.00 002 test2 120.00表2 id up_id value2 1 001 top 2 002 button莫非你想: 现在我想查出的结果为: id name value value2 001 test1 100.00 button 002 test2 120.00 top?????
select a.id, a.name, a.value, b.value2 from tab1 a,tab2 b where a.id <> b.up_id不就可以了
谢谢各位..如果 表1id name value 001 test1 100.00 002 test2 120.00表2 id up_id value2 1 001 top 2 003 dow这样用 select a.id, a.name, a.value, b.value2 from tab1 a,tab2 b where a.id <> b.up_id 可以查出: id name value value2 002 test2 120.00 top 的结果吗?
select a.*,b.value2 from t1 a,t2 b where not exits (select 1 from t1,t2 where t1.id=t2.up_id);
select distinct(a.id),a.name,a.value,b.value2 from t1 a,t2 b where a.id in (select id from t1 minus select up_id from t2)
001 test1 100.00
002 test2 120.00表2
id up_id value2
1 001 top
2 002 button莫非你想:
现在我想查出的结果为:
id name value value2
001 test1 100.00 button
002 test2 120.00 top?????
from tab1 a,tab2 b
where a.id <> b.up_id不就可以了
表1id name value
001 test1 100.00
002 test2 120.00表2
id up_id value2
1 001 top
2 003 dow这样用
select a.id, a.name, a.value, b.value2 from tab1 a,tab2 b where a.id <> b.up_id
可以查出:
id name value value2
002 test2 120.00 top
的结果吗?
where a.id in (select id from t1 minus select up_id from t2)