select * The from (select rt objid, Rt. The title, SFD forcastvalue, SFD indicatorcode, Rt ratingvalue, To_char (SFD) forcasttime, 'yyyy) baseyear, (case SFD. Indicatorcode When the '0011' then SFD. Forcastvalue The else ' End) price, (case SFD. Indicatorcode When the '0004' then SFD. Forcastvalue The else ' End) eps The from ir_report rt Left the join sr_stockforecastrelation SFR on SFR. Sourceentity= Rt. Entityname And SFR) sourceid=rt) objid Left the join sr_stockforecastdetail SFD on SFD. Forecastid= SFR. Forecastid
Where rt. Objid=3111 And SFD. Indicatorcode in (0004, 0011) The order by SFD. Forcasttime)
Perform Objid title code ravalue year price eps D 0004 50, 2016, 1 3111, flags, drum 1.40 2, 3111, zero flag drum D 0011, 50, 2017 52 3, 3111, zero flag drum D 0004, 50, 2017 1.00 I want the effect of Objid title code (can be removed) ravalue year price eps 0004/0011 3111, zero flag drum, 1 D (can be removed) 50 2017 52 1.00 Is according to the maximum of objid and year to merge a line, strives for the great god modify!!!!!!!!!!!!!!!!!!!!!!!!!!!!