I have a person table with fields id, email.
And a subscription table with fields: person_id, category_id.
If a person is subscribed subscription table will have at-least one entry in the table.
I want to query person table with the 3rd column having 1 or 0 depending on whether person is subscribed or not.
select p.id, p.email , [is_subscribed]
from person p
is_subscribed should be 1 if there is an entry in the subscription table else should be 0.
How can I achieve the above ?
Using a LEFT JOIN on subscription & a count (in a case of several subscriptions)