How to get unique values from each column based on a condition?
I have been trying to find an optimal solution to select unique values from each column . My problem is I don't know column names in advance since different table has different number of columns. So first, I have to find column names and I could use below query to do it: select column_name from information_schema.columns where table_name='m0301010000_ds' and column_name like 'c%' Sample output for column names: c1, c2a, c2b, c2c, c2d, c2e, c2f, c2g, c2h, c2i, c2j, c2k, ... Then I would use returned column names to get unique/distinct value in each column and not just distinct row . I know a