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

vtxmg's avatar

How to sync data based on extra column on pivot

Hello everyone ,, I created a pivot table with three main columns. post_id, tag_id, category_id.

Now I want to sync post with tag according to category_id. [category_id is just a extra column]

id      post_id     tag_id      category_id
1       2           3           1       
2       2           3           2
3       3           3           1
4       3           3           2

As I said before, I want to sync post with tag where category_id = *.

0 likes
2 replies
pmall's avatar

Please explain a real life utility of this because it is hard to understand what you want to achieve

1 like
vtxmg's avatar

Say I've website_id instead of category_id ... Now in one website there may different relationship with post and tag and in another with different. @pmall

Please or to participate in this conversation.