SELECT语句 - 向结果集添加其他列

时间:2012-12-07 01:01:42

标签: sql oracle

如何更改此代码以查看结果中的A列和D列?

SQL> SELECT A FROM R WHERE EXISTS
     (SELECT D FROM S WHERE S.D=R.A AND S.C=R.B);

结果:

A
----------
1 

2 个答案:

答案 0 :(得分:4)

Select 
  A, D
From
  R
    Inner Join
  S
    On S.D = R.A And S.C = R.B

答案 1 :(得分:1)

SELECT R.A, S.D
FROM R
INNER JOIN S ON S.D = R.A AND S.C = R.B