Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query help

Author  Topic 

Idunnit1
Starting Member

8 Posts

Posted - 2010-01-20 : 15:53:02
I have 3 tables, which are:

game_users
with fields id, uid, score
1 63 0
2 64 0

predictions
with fields id, uid, pred1, pred2
5 63 john fred
9 64 fred bob

Results
with fields id, result1, result2
1 john bob

I need a query that would give the user 1 point for each correct prediction. I know how to update a score but I cannot work out how to do it for each user and to score on weather they have the prediction correct. With the tables above both users would have 1 point each as they got 1 correct each.

I just cant get my head round a query for this

Please help.
Thanks

shan
Yak Posting Veteran

84 Posts

Posted - 2010-01-20 : 16:28:35
I am not clear on the criteria of final result. how do you identify John and Bob made the predictions.


-Shan
Go to Top of Page

Idunnit1
Starting Member

8 Posts

Posted - 2010-01-20 : 16:58:25
Hi shan,

If you look at is as though bob, fred, john etc are running a race. Each user is basically guessing who will come in first and who will come in second. I have entered the actual race results and it works out that user 63 has guessed correctly with his 1st place but not his second place so he would earn 1 point. Then user 64 also has 1 point because he has guessed second place correct by guessing bob would be in second place and so on.

Does that help
Go to Top of Page
   

- Advertisement -