$data = mysql_query("
SELECT t1.name, t1.surname,t1.id as id2,
(SELECT count(*) FROM scores t2 WHERE t2.tourney_id='$tourney_id' and
t2.player_1='$id' and t2.player_2 IS NOT NULL and t2.score_1 > t2.score_2) as wins1,
(SELECT count(*) FROM scores t2 WHERE t2.tourney_id='$tourney_id' and
t2.player_1='$id' and t2.player_2 IS NULL) as wins2,
(SELECT count(*) FROM scores t2 WHERE t2.tourney_id='$tourney_id' and
t2.player_2='$id' and t2.score_2 > t2.score_1) as wins3,
(SELECT count(*) FROM scores t2 WHERE t2.tourney_id='$tourney_id' and
t2.player_1='$id' and t2.player_2 IS NOT NULL and t2.score_1 < t2.score_2) as loses1,
(SELECT count(*) FROM scores t2 WHERE t2.tourney_id='$tourney_id' and
t2.player_2='$id' and t2.score_2 < t2.score_1) as loses2,
(SELECT COUNT(*) FROM scores t2 WHERE t2.tourney_id='$tourney_id' and
t2.player_1='$id' and t2.player_2 IS NOT NULL and t2.score_1 = t2.score_2) as draws1,
(SELECT COUNT(*) FROM scores t2 WHERE t2.tourney_id='$tourney_id' and
t2.player_2='$id' and t2.player_1 IS NOT NULL and t2.score_1 = t2.score_2) as draws2
FROM players t1 WHERE id='$id'");