I am trying to write a sql statement to return unique userid for reviews they posted where all of their reviews are '3 star' or greater. My current statement returns users that have made '3 star' reviews or greater, but also includes them if they've made reviews of less than. How should I fix it to exclude those who have made less than '3 star' reviews. A user can make multiple reviews which is why I thought DISTINCT userid would work.
I've tried this one below, but the syntax isn't right. I feel like I'm on the right track, but I'm not sure what to change.
That's good advise, but the OP would still have the problem of when a user had a 3 star or greater review, but then had other reviews that were less than 3 stars.
I was thinking maybe use the ALL keyword, but in trying to construct the SQL, I ran into a problem I couldn't solve.
Maybe just use programming. Use your first SQL statement to get all possible users, even if they have reviews less than 3 stars. Then for each user in that list, create an SQL statement like
You would use a prepared statement to fill in the "?".
All things are lawful, but not all things are profitable.