Jump to content

What is wrong with this query and table setup?


Darkmatter5

Recommended Posts

Tables

 

game_collections

game_idmember_idsystem_id

4226

 

games

game_idtitle

4Fallout 3

 

systems

system_idname

6Xbox 360

 

The query:

SELECT games.title, systems.name
FROM game_collections
INNER JOIN game_collections ON game_collections.game_id=games.game_id
INNER JOIN games ON games.game_id=game_collections.game_id
INNER JOIN game_collections ON game_collections.system_id=systems.system_id
INNER JOIN systems ON systems.system_id=game_collections.system_id
WHERE game_collections.member_id=4

 

Why is this query giving me a "1066 - Not unique table/alias: 'game_collections'" error?

 

I'm wanting to get

games.titlesystems.name

Fallout 3Xbox 360

Try this.. I had the where clause in there, but it didn't give me the same result.. you have member_id instead of game_id I think

SELECT gc.member_id,g.title, s.name FROM games g
JOIN game_collections gc USING(game_id)
JOIN systems s USING(system_id)
WHERE g.game_id = 4

If you're going off member_id, the member_id is 22

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.