Francesco Francesco - 1 year ago 140
SQL Question

Simulate a left join without using "left join"

I need to simulate the left join effect without using the "left join" key.

I have two tables, A and B, both with

columns. I would like to select all the dbids on both tables, where the name in A equals the name in B.

I use this to make a synchronization, so at the beginning B is empty (so I will have couples with id from A with a value and id from B is null). Later I will have a mix of couples with value - value and value - null.

Normally it would be:

FROM A left join B
ON =

The problem is that I can't use the
left join
and wanted to know if/how it is possible to do the same thing.

Answer Source

you can use this approach, but you must be sure that the inner select only returns one row.

(select from B where = as B_ID
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download