I have 3 tables with the following schema
Table1 - plan
id | count
Table2 - subscription
id | plan_id
Table3 - users
id | subscription_id
I have to select count from plans where its plan.id matches with subscription.plan_id matches and users.subscription_id matches with subscription.id and users.id = '5'
How can I use a JOIN here?
I tried using with no JOIN as below:
SELECT count
FROM users, subscription, plan
WHERE users.id = '5' and users.subscription_id = subscription.id and subscription.plan_id = plan.id;