Skip to content

Left join using a temporary column

I want to do left join on two tables but the second table doesn’t have required column. So a temporary column (concat of two column values in second table) is needed in order to do the left join.

Obviously this shows error:

SUBQUERY_MULTIPLE_ROWS: Scalar sub-query has returned multiple rows.

But I don’t need this tempcol to show in the main query nor save it as new column in any tables here.

What is the better way to do left join on temporary column?

Advertisement

Answer

You don’t need a subquery for the join. Just use the expression:

If you like, you can use a subquery:

User contributions licensed under: CC BY-SA
4 People found this is helpful