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? Link to comment https://forums.phpfreaks.com/topic/195832-best-place-to-put-this/ 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? Link to comment https://forums.phpfreaks.com/topic/195832-best-place-to-put-this/#findComment-1028700 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? Link to comment https://forums.phpfreaks.com/topic/195832-best-place-to-put-this/#findComment-1028705 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 Link to comment https://forums.phpfreaks.com/topic/195832-best-place-to-put-this/#findComment-1028709 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.