On Mon, Jan 24, 2011 at 10:52 AM, Adam Parker <[email protected]> wrote:
>
> When assigning judges to review poems, can I use this table to hold the data 
> of which judges review which poems and the rates they give the poems?
>

> When the forms submits, I use:
>        <cfquery name="updateJudge" datasource="#request.dsn#">
>        INSERT INTO PoetryJudges (poemID, judge)
>        VALUES (#form.poemid#, '#form.judge1#')
>        WHERE ID = #form.poemid#
>        </cfquery>
>
> How would I handle the event where more than one judge is assigned a poem?

1) There is no "where" in an insert. You want an Update statement when
modifying records.

2) Put in a "votes" table with JudgeID and PoemID and Rating. This
way, multiple poems can be voted on by one judge. When you want to
display stats,

Select average(rating) as score
from votes
where (Whatever you want to see) = (the datapoint).

So if you want the judges score, put in JudgeID = (Whatever judge you
are looking at). If you want to see a poems score, put in PoemID =
(The Poem ID number).



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5212
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm

Reply via email to