I'm trying to insert values into some table with this code using C# and SQL:
string query1 = "select PlayerID from Table1";
string query2 = "select GameID from Table2";
string q = "insert into Table3 (PlayerID, GameID) values(" + query1 + "," + query2 + ")";
Is it possible?
Edit:
I have 3 tables:
playersTbl- with auto increment id (primary key)gameTbl- with auto increment id (primary key)JoinTbl
When the game is starting, the user can register some players to the same game, so in the same game lets say there are 4 players.
When I'm adding those 4 players the playersTbl will look like:
ID | first name|
----------------
1 | p1 |
2 | p2 |
3 | p3 |
4 | p4 |
and the gameTbl will look like:
ID | Date | Hour|
-----------------
1 | | |
So what I'm trying to do is the Table3 will look like:
PlayerID | GameID|
------------------
1 | 1 |
2 | 1 |
3 | 1 |
4 | 1 |
Now when I'm starting a new game with one player
I'm adding the player to the playersTbl, and the game to the gameTbl, but now the third table will look like
PlayerID | GameID|
------------------
1 | 1 |
2 | 1 |
3 | 1 |
4 | 1 |
5 | 2 |
to be more clear, I don't want that players which are registered in the second game will be in the first game..