SQL AVG in subselect?

Firstly, always try to avoid using a correlated subquery when you can achieve the same result with a join, the optimiser will deal with it much better and you'll get the results faster.

You got the set of records which have the specific id and rate_category. And avgRate is an average value from all records with the same rate_category - this set has the outer one as subset(see conditions of both queries). So all returned records have the same avgRate value.

So I see some holes in your logic line.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions