K
K
Kanat Kharasaev2016-05-30 23:31:54
PHP
Kanat Kharasaev, 2016-05-30 23:31:54

How to make a selection from three tables (new)?

People help with the request, even it doesn’t work out, what am I doing wrong? It is necessary to display data from two tables according to different parameters, connected by one game table, data from the first table (npc) is displayed normally, and nothing from the second

SELECT game.id,game.type,npc.title,users.login FROM game LEFT JOIN npc ON game.id = npc.npc_id AND game.type = 'npc' 
        LEFT JOIN users ON game.id = users.user_id AND game.type = 'user' WHERE game.loc = '".$this -> user['loc']."' AND game.login != '".$this -> user['login']."' ORDER BY game.sort

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question