jeudi 4 février 2016

[SQL]-SELECT a column then INSERT that column again randomly

I've got a table:

player_id|player_name|play_with_id|play_with_name|

I made this table for a game.

-Everyone who wants to play,can sign up to it.

-When they sign up the table stores:player_id and player_name

-When the period while they can sign up expires i want to assign every player_name to play_with_name randomly.

So for example.. my structure would like this when they in sign up period:

player_id|player_name|play_with_id|play_with_name|
1          someone1
2          someone2
3          someone3
4          someone4
5          someone5

And this when the period expires:

player_id|player_name|play_with_id|play_with_name|

    1       someone1      2              someone2
    2       someone2      1              someone1
    3       someone3      4              someone4
    4       someone4      3              someone3
    5       someone5      -                 -




Aucun commentaire:

Enregistrer un commentaire