I have the following 5 tables:
users(user_id)
books(book_id, author_id)
source_phrases(source_phrase_id, book_id, phrase)
synonym_phrases(synonym_phrase_id, source_phrase_id, reader_id, synonym)
synonym_ratings(synonym_ratings_id, synonym_phrase_id, rater_id, rating)
I am trying to get a query that will select all the books a user has completed reviewing.
A user will have completed reviewing a book if they have done the following for each source phrase:
User has suggested a synonym for the source phrase (reader_id in synonym_phrases table is the users id)
OR
The user has rated a synonym for the source phrase (rater_id in synonym_ratings table is the users id)
I have spent a whole day trying to get this with no joy. Any help would be much appreciated.