sql - return a column name depending upon another column field value in oracle -
I have written a code like this:
SELECT C. *, CASE when .COST_CENTRE_NAME is no longer 'yes', when CGL_Code is not zero then 'yes' when c. If MATTI is not OADOE then 'yes' no 'no' is not an option till the end oyster 3 I need another column to be associated with this designated DEPENDS_ON with CAA_RULIM C, where the column value of this column will depend on the value of 'Yes' or 'No' of DEPENDS_OTHER. If DEPEND_OTHER column value is yes, then it should return the column name for which it comes yes under the DEPENDS_OTHER column. I am giving an example below: id COST_CENTRE_NAME GL_CODE MATERIAL_CODE depend_other depend_on 1 A yes COST_CENTRE_NAME 2 no 3 123 Yes GL_CODE 4 a2 Yes MATERIAL_CODE 5 No
Just repeat what you started:
Select c *, When case c is cost_centre_name, then zero 'yes' when' c'gl_code is not zero, 'yes' when c.material_code is not zero, then' yes' and 'no' end depends, case when c. If not c.material_code is zero, then 'MATERIAL_CODE' is the other redundant end, depending on oyster3.cat_rule_mv c if not c.m_code, then 'COST_CENTRE_NAME' if not c. / Pre>
Comments
Post a Comment