Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl and MySQL

Status
Not open for further replies.

grindange

Programmer
Jul 19, 2004
18
SE
I'm programming in Perl...
Have quiz on a website, it's 20 question with three alternative and one elimination question. The answer on the elimation question is a value between 1 and 50.

The database who is connected to the website have the columns "name", "points" and "elimination"

I need a SQL-statment or a perl script to order the the competitor who have the same points. The one who is closest to the the elimination answer should be first.

E.g: Two competitor have 20 points, one of them have answered 15 an the other 25 on the elimination question. The correct answer is 17, so 15 is closest and he should be number one.

Anyone who can help me!
 
Incidentally, you might consider changing your system to store the difference between the elimination answer given and the correct answer, rather than storing the actual value.

That way you could change the question in the future and not require the right answer to always be "17".

-- Chris Hunt
 
The ABS-statment was the answer on my question.
Thanks a lot!!

/ Marcus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top