0

I have 2 table , the first table hold tags that one user love them enter image description here

and the second table shows tags of one post

enter image description here

I want to call a query that gets tags that this user loves them and then return related posts to this tag without duplicate

  • Simply JOINing these tables will not accomplish that. You could concatenate the related postID to a single CSV string. – June7 Dec 25 '22 at 20:52
  • it solved by this command FavUserTags.hasOne(PostHashtak, { foreignKey: 'hashtakId', // <--- one of the column of PostHashtak - SubTask: not a primary key here in my case; can be primary key also sourceKey: 'hashtakId', // <--- one of the column of FavUserTags - Task: not a primary key here in my case; can be a primary key also }); – mohammad reza shabani Dec 27 '22 at 11:42

0 Answers0