Hello
Let’s say I have have a Videos table and column (1:N) called LikedBy. this column is a relationship to the user table. Essentially the Videos table list all videos posted by all users and each video is liked by many users.
What I am trying to get is to get ALL the likes that a poster (user) received for his videos.
Therefore a user might have 4 videos and each video is liked by 2 users (can be the same users) then the total count would be 8
One way to do that is to do a query that will get me count of related data grouped by videoID and the where clause will specific the poster objId. The downside is that I have to iterate in code through all the results to add the counts up (which might have paging overhead on top).
Is there a shortcut way that can get me the total count? Maybe somehow by going through the opposite direction (count the users who has a like relationship to, coming from video whose poster is xyz)? I don’t know maybe another method I am skipping.
I just don’t want to overcomplicate things if there is a shortcut
Thank you so much for your support today in this.