Conditional values within a SQL function?
Hi there,
I don't know if this is even possible, but I have a client who has a fairly simple table of ratings for players in a sports league - a coach_rating and a league_rating. Typically, the logic is 'if the league rating is defined, use that; otherwise, use the coach rating' (this is so coach ratings may be overridden).
This was all well and good until the client decided that they want historical, statistical analysis done on 'the rating.' I can get the mean and standard deviation of one rating or the other; is there a way to tell SQL to 'take the average of the values in column A, but if there is a value in column B, substitute that value'?
I realize that I could simply pull the raw numbers out of the database and do the math in CF, but I'm trying to avoid that unless there's no other way.
Thanks!
Aq
