Move the WHERE clause to after the Joins (which are actually part of the From clause), and I suspect you want a Left join (as you implied the other table may not have matching rows)
Code:SELECT COLUMN_NAME, `table2`.fieldName FROM INFORMATION_SCHEMA.COLUMNS LEFT JOIN `common_field_names_table` WHERE TABLE_SCHEMA='myDB' AND TABLE_NAME='table1' ON `INFORMATION_SCHEMA`.`COLUMN_NAME` = `table2`.fieldName




Reply With Quote