Help to combine 2 requests into one

SELECT id FROM players WHERE player = 'test' SELECT * FROM history WHERE id = id 

1 answer 1

In your case it will be like this:

 SELECT h.* FROM `players` p JOIN `history` h ON (h.id=p.id) WHERE (p.player='test') 
  • LEFT JOIN assumes that there may be no data in history. Why then in the SELECT section only h.* ? Why print blank lines in the sample, if any? - 4per
  • Thank! Hurry up. Fixed :) - Stanislav
  • This query is suitable, if we allow a string with id not found, will it skip it or will it output null? - Sergey
  • This query will execute as standard. - Stanislav
  • If my answer decided your question - mark it as a solution :) - Stanislav