I want to return column names into a table. But I also want to avoid redundancies like 'id' and 'id'.
INSERT INTO columns(name) SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name='contacts' or table_name='companies';
But as expected I get
id from the first table showing up with the same field name.
How do I get it in the form: