sql - MySQL - Select multiple rows from one table whose IDs are stored in another table -


I am using a JOIN - statement to select my data from my MySQL database . Tables look like:

  table "user" + ---- + ------- + ---------- + | ID | Name | Password | + ---- + ------- + ---------- + | 1 | Mike | Test | | 2 | Tony | Test1 | | 3 | Frank | Test2 | + ---- + ------- + ---------- + Table "Games" + ---- + ----------- + --- -------- + --------- + --------- + | ID | Player1ID | Player 2 ID | Score 1 | Score P2 | + ---- + ----------- + ----------- + --------- + --------- + | 1 | 1 | 2 | 5 | 2 | | 2 | 3 | 1 | 2 | 1 | + ---- + ----------- + ----------- + --------- + --------- +   

I like SELECT * games where Player1ID = 1 or Player2ID = 1 plus users' names and not just their ID. Can somebody help me out?

User Join the table with two different names so that they differ Can

  select g *, As the U1.name player1, u2.name player player as player 2 player in user g in U.U.U.U.Uid 1.id = g.player1idUU U2 on UU 2.ID = G Join Player2id    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -