To begin with I have two tables:
feeds:(id,content_id,author) and feeds_ratings:(id,feed_id (FK to feeds(id)),user_id,rating)
What I want to do is get the total rating difference for a specific author by a certain user.
To explain a bit more, let's say we have three rows in the feeds table, (1,3245,test),(2,3215,test),(3,3122,test) and tree rows on the feeds_ratings table, (1,1,12,like), (1,2,12,like),(1,3,12,dislike)
The input will be the user_id and the author and I want the output to be the difference between the total dislikes and likes by the input user, for the specific input author. (In this example it will be 1 because of the two likes and the one dislike.
How can that be implemented in a mysql query? I tried searching and some code of my own but I can't make it work, so any help is appreciated!