N-Bomb(Nerd) Posted March 19, 2010 Share Posted March 19, 2010 Hi, I have a table called "winners" -- in there I have columns "id, total_wins". I'm trying to have one more column called "last_winner", but only restrict one person to have the last_winner. Do I create a new table for last_winner or do I include it on the winners table? If I include it on the winners table, how do I go about making sure that only one person is the winner? Quote Link to comment Share on other sites More sharing options...
schilly Posted March 19, 2010 Share Posted March 19, 2010 why do you need a column for that? can't you assume that the last winner is the person who has the most recent record in the winners table? Quote Link to comment Share on other sites More sharing options...
N-Bomb(Nerd) Posted March 19, 2010 Author Share Posted March 19, 2010 why do you need a column for that? can't you assume that the last winner is the person who has the most recent record in the winners table? How would I get the most recent record in the winners table? Quote Link to comment Share on other sites More sharing options...
schilly Posted March 19, 2010 Share Posted March 19, 2010 select * from winners order by id desc limit 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.