I have two tables: clients
and subcontractors
. Clients has many subcontractors. Subcontractors can have many clients.
My schema goes something like this:
clients
->id
->name
->status
subcontractors
->id
->client_id
->name
My question is how do I count clients with 1 to 2 subcontractors in them?
Thanks. I tried checking this one:
SELECT COUNT across one-to-many relationship
But it seems that this is the reverse of what I am trying to count