Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

finlamit's avatar

Matchmaking service. Comparing 2 pivot tables.

Hi.

I am creating a matchmaking service on my website.

I have 5 tables: Buyers, Sellers, Categories, buyer_categories(Pivot), seller_categories(Pivot).

Users will be creating an account as a BUYER, selecting 5 categories they are looking to buy in. The data of what categories they have selected will be stored in the buyer_categories table with: id,buyer_id,category_id.

Users will be creating an account as a SELLER, selecting 5 categories they are looking to sell in. The data of what categories they have selected will be stored in the seller_categories table with: id,seller_id,category_id.

What I need is a way of displaying pulling the data so that it shows you matched buyers/sellers that have selected the same categories as you. Matching buyers to sellers and vice versa.

What makes it more tricky as the way it needs to be displayed is ranked by those who match the most categories as you have.... as I want to display it like this.

"These buyers have matched 5 of your selected categories" ... ... ... ... "These buyers have matched 4 of your selected categories" ... ... ... "These buyers have matched 3 of your selected categories"

Any advice or ideas?

Thanks

M

0 likes
1 reply
chris4ever's avatar

Hi finlamit,

I am facing a similar requirement, did you find any ideas and solutions to build this match making?

Please or to participate in this conversation.