> At anytime, the weighted values will change

if i vote a 4 for an item, can i go back and change my vote to a 6 later?

i think you meant that a 4 could go from being worth 25 pts to 30, but i
could never change my 4

even so, you're already keeping individual votes, right?  you'd have to
for sure if the weights could change

by the way, that scale you showed doesn't show weights for 9 and 10
(i'm assuming you just overlooked these)

> Before the weighted value was required I had this:
>
>       select avg(vote) as average_vote from votelist
>           group by vote
>           order by vote

cool

> now I think I'm going to have to set-up an array to
> deal with it and loop through the array to apply the
> weighted values and then average it out

that's not the way i'd do it, i'd store the weights in a table and do a
join

boatloads simpler than writing a loop

   select avg(vote * weight) as weightedavg
     from yourtable, weighttable
       where yourtable.vote = weighttable.vote
     group by vote, weight
       order by vote

since vote/weight is a 1-1 relationship, this GROUP BY is the same as vote
alone

ORDER BY probably not necessary, although some databases recommend you
include it just to be sure

rudy



-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: "rudy" <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)

Reply via email to