Skip to content
Advertisement

Select column as true / false if the keypair exists in another table

I have currently these tables. Server: MariaDB

(I removed some columns to make it more simple)

I try to achieve this result

Test with Person id = 1

Test with Person id = 2

I tried to do it with IN, JOINs, nested queries.

Advertisement

Answer

Is this what you want?

The ? is the placeholder for your person id of interest.

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