I have a database that has two tables, these two tables are defined:
Movie ----- ID Title (nvchar) Movie Review ----------- ID (Int) MovieID (Int) Storytaking (Decimal) Working (Decimal) Acting (Decimal) < / Code>
I have a stored procedure that allows users to query movies based on other user reviews She is Currently, I have a temporary table that has a population of the following queries:
SELECT M *., (SELECT COUNT (ID) from MovieReivew r WHERE r.MovieID = m.ID) 'Average rating' from '
in the form, (Select AVG (R. Storeyering + R. Homeraring + R. ActingRating) / 3) MovieRevV R to WHERE r.MovieID = m.ID) In a later query in my process, I basically want to say:
SELECT * MyTempTable t WHERE t.AverageRating & gt; = @lowestRating and t.AverageRating & lt; = @highestRating
My problem is, sometimes the average reservation is zero. Because of this, I'm not sure what to do, how do I manage this scenario in SQL?
I'm thinking that you want to watch movies with zero reviews in your results.
Total vacancies test It is safe to do, because it will never tap.
Comments
Post a Comment