应该不会的t.tit>50是t.title>50吧

解决方案 »

  1.   

    RIGHT OUTER JOIN—This returns all the rows from the table on the right side of the join, along with the values from the left-hand side, or nulls if a matching row doesn't exist. 我认为你第一句就应该有问题了
    外连接一般是不能与条件语句并列使用的(我现在没有oracle进行测试),你可以试试
    既然右边的要全部出现,那么以左边的表字段进行限制当然是没有意义的了
      

  2.   

    因为你是右连接表titles, 除了连接条件外,不应该再加表titles的限制条件。
      

  3.   

    我的意思是只要将titles 表中的少数符合t.tit>50条件的记录与sales表做外联接.SELECT s.stor_id, s.qty, t.title
    FROM sales s , titles t
    where s.title_id = t.title_id (+)
    AND s.qty > 50 AND t.tit>50
      

  4.   

    但是这样,如果过滤后的titles 没有对应的记录的话,一条记录也没有
    我本来要得到这样的:stor_id     qty     title
    1          T1        null
    2          T2        null
    3          T3        null
      

  5.   

    那就这样SELECT s.stor_id, s.qty, t.title
    FROM sales s , (select * from titles where tit>50 ) t
    where s.title_id = t.title_id (+)
    AND s.qty > 50