Sample Header Ad - 728x90

Find columns with different values compared with a reference row

2 votes
1 answer
6751 views
My table, MARC, has more than 200 columns with WERKS (plant) as the key. Most of the entries in MARC have values that come from a *reference plant*. So, usually, all the 200 columns will contain the same values. I need to find the columns that have different values compared with the reference plant row, in order to find the deviations and show the names of the columns that had different values. The main question is: how to do the select when it is not known which columns need to be selected. ### Example data screen shot In the above, ABAS is the reference plant. I expect only the first row to be returned, because only that row contains any differences compared with the reference row. Differences in that row occur in the following columns: * WERKS * PSTAT * DISMM * DISPO The returned row should contain *only those four columns*. I do not need any other columns to be able to show on the UI that these 3 columns have different values for that particular WERKS. I am using SAP HANA.
Asked by user2293813 (31 rep)
Aug 14, 2015, 11:23 AM
Last activity: Aug 15, 2015, 05:51 PM