sqlsqlite

SQL query to merge columns from two tables


I need to join results from two tables into one set. The tables are ordered as such:

gameData: [Id,TeamID, data..........]

players: [Id (same as above), name, data.....]

I need to do something like:

SELECT * FROM gameData and
SELECT data FROM players WHERE gameData.Id = players.Id

And here is what I have thus far.

SELECT * FROM gameData AS A LEFT OUTER JOIN players AS B on A.playerID = B.Id;

And have it return all of the values from A, and only the data from B.

I know that the syntax is not correct, I have little experience working with SQL joins. What can I try next?

Edit

Can I do something like: "Select a.* from tableA as a"?


Solution

  • Select a.Id, a.TeamID, a.data, b.data
    FROM gameData as a
    LEFT OUTER JOIN 
    players b On a.ID =  b.ID