How can I select columns even if I don't know whether they exist in a particular table?
So something like:
SELECT if_exists(col1, col2), col3
FROM tab1;
The result would only be the content of columns, that really exist in the tab1
.
Background: I want to make a dynamic query with PHP, where the table will be dynamically inserted. Most tables have the same structure (same column names), but some of them have slightly different column names. Changing the names is not an option for some reasons.