0

Here's my working query:

SELECT 
d.*, g.name game, 
 (SELECT GROUP_CONCAT(p.name) FROM shows_players p 
  LEFT JOIN (SELECT * FROM shows_map) sm ON sm.player_id = p.id 
  WHERE sm.show_id = d.id AND sm.game_id = g.id) players 
FROM shows_dates d 
LEFT JOIN (SELECT * FROM shows_map 
           WHERE player_id = 5 GROUP BY show_id, game_id) m ON d.id = m.show_id 
LEFT JOIN shows_games g ON g.id = m.game_id

It's a fine query until adding the "WHERE player_id =" line. Then it returns some rows with no data. How do I clean this up and get rid of these?

Thank you

4

1 回答 1

1

一个简单的解决方案可能是更改LEFT JOIN (SELECT * FROM shows_mapINNER JOIN (SELECT * FROM shows_map.

我想你会得到一些空的 NULL 数据,因为你使用的是 LEFT JOIN。

而且您的查询非常混乱。

于 2012-05-03T07:03:35.620 回答