(select COL1 from dxp_102544 where a a.t ab_year=t.t ab_year and a.t ab_month=t.t ab_month and Anderson tem_code in (' BKD100 ', 'BKD200)),
(select COL7 from dxp_102544 where a a.t ab_year=t.t ab_year and a.t ab_month=t.t ab_month and Anderson tem_code in (' BK4100 ', 'BK4200))
As LJ from dxp_102544 t where t.i tem_code in (' BK4100 ', 'BK4200)
Could you tell me how to change greatly
CodePudding user response:
(select COL1 from dxp_102544 where a a.t ab_year=t.t ab_year and a.t ab_month=t.t ab_month and Anderson tem_code in (' BKD100 ', 'BKD200)),(select COL7 from dxp_102544 where a a.t ab_year=t.t ab_year and a.t ab_month=t.t ab_month and Anderson tem_code in (' BK4100 ', 'BK4200)
Check that the two statements have returned many rows
CodePudding user response:
I am a beginner, please modify, let see the result, thank youCodePudding user response:
This depends on business requirements, you can directly good change, but I have modified the result is not necessarily the needs of your business...CodePudding user response:
CodePudding user response:
I want 2016 7 LJ BKD200 valueCodePudding user response:
The most simple, you Max or min as a result, such as Max (COL1), Max (COL7), it must be a recordCodePudding user response:
You this statement is submitted to the following error?ORA - 01427: single subquery return multiple rows
Almost as the query result is much the
That the original poster spelled wrong:
(SELECT COL1 FROM DXP_102544 WHERE A A.T AB_YEAR=T.T AB_YEAR AND A.T AB_MONTH=T.T AB_MONTH AND Anderson TEM_CODE IN (' BKD100 ', 'BKD200)),
(select COL7 from dxp_102544 where a a.t ab_year=t.t ab_year and a.t ab_month=t.t ab_month and Anderson tem_code in (' BK4100 ', 'BK4200)) AS LJ one-to-many association will happen, with the following statement:
SELECT DECODE (T.I TEM_CODE, 'BK4100', 'BKD100', 'BK4200', 'BKD200' T.I TEM_CODE) AS ITEM_CODE,
TAB_MONTH TAB_YEAR AS YEAR, AS the MONTH,
A.C OL1,
Biggest OL1
The FROM DXP_102544 T
LEFT the JOIN DXP_102544 A
ON A.T AB_YEAR=T.T AB_YEAR AND A.T AB_MONTH=T.T AB_MONTH AND Anderson TEM_CODE IN (' BKD100 ', 'BKD200)
LEFT the JOIN DXP_102544 B
ON B.T AB_YEAR=T.T AB_YEAR AND B.T AB_MONTH=T.T AB_MONTH AND B.I TEM_CODE IN (' BK4100 ', 'BK4200)
WHERE T.I TEM_CODE='BK4200'
;
CodePudding user response:
Combined with Max or behind the where to specify a record rownum=1