select (case a.shipduty_Id when in (select shipduty_Id from ShipyardProjectinfo) then ShipyardProjectinfo.ProjectInfo else 0 end) ProjectInfo,a.shipduty_id,a.inputtime,a.disposeType,a.defendOfficeOperate,b.ShipSerial,b.ship_Id from Workshipduty a,shipinfo b where a.ship_Id=b.ship_id and a.disposeType>3 order by a.shipduty_id desc

解决方案 »

  1.   

    (case a.shipduty_Id when in (select * from ShipyardProjectinfo) then ShipyardProjectinfo.ProjectInfo else 0 end) 有问题。
    改一下:
    select nvl(c.shipduty_Id), ProjectInfo,a.shipduty_id,a.inputtime,a.disposeType,
    a.defendOfficeOperate,b.ShipSerial,b.ship_Id 
    from Workshipduty a,shipinfo b,(select shipduty_Id when in (select * from ShipyardProjectinfo))c
    where a.ship_Id=b.ship_id and a.disposeType>3 and a.shipduty_Id=c.shipduty_Id(+)
    order by a.shipduty_id desc
      

  2.   

    sorry:
    select nvl(c.shipduty_Id,0), ProjectInfo,a.shipduty_id,a.inputtime,a.disposeType,
    a.defendOfficeOperate,b.ShipSerial,b.ship_Id 
    from Workshipduty a,shipinfo b,
    (select shipduty_Id when in (select * from ShipyardProjectinfo))c
    where a.ship_Id=b.ship_id and a.disposeType>3 
    and a.shipduty_Id=c.shipduty_Id(+)
    order by a.shipduty_id desc