Hello
I am looking to:
Get all the fields of a View/Table from information_schema
Search for '%something%' in each of these fields
Put the results of each of these subqueries one next to the other
Since the length of the results lists may not be the same, I would like to populate any rows needed with null
So let's say we have a table:
Col1, Col2
I want to search for '%something%' in Col1 and Col2 etc
Let's say searching Col1 returns:
Something1
Something2
Col2 returns nothing
Col3 returns:
Something10
Something20
Something30
So the end result table should be:
Col1 | Col2 | Col3 |
---|---|---|
Something1 | NULL | Something10 |
Something2 | NULL | Something20 |
NULL | NULL | Something30 |
Any idea how to do that? I would really need something neater than me repeating all the columns of the table one by one. Something like recursive search and horizontal appending.
Thanks!