I\'m trying to select the first non-null value between multiple columns in one table while selecting columns from another table as well. The SQL query is as follows