Think it would be:
-- 6 degrees of separation
SELECT player_id, ps.player_state, ps.email, ph.create_date
FROM game.phone_hashes ph
INNER JOIN game.customer_settings cs ON cs.id = ph.player_id
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE player_id = $1))))));
Please see workings below:
-- 1 degree of separation
SELECT player_id, ps.player_state, ps.email, ph.create_date
FROM game.phone_hashes ph
INNER JOIN game.customer_settings cs ON cs.id = ph.player_id
WHERE hash IN
(SELECT hash FROM game.phone_hashes WHERE player_id = $1);
-- 2 degrees of separation
SELECT player_id, ps.player_state, ps.email, ph.create_date
FROM game.phone_hashes ph
INNER JOIN game.customer_settings cs ON cs.id = ph.player_id
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE player_id = $1));
-- 3 degrees of separation
SELECT player_id, ps.player_state, ps.email, ph.create_date
FROM game.phone_hashes ph
INNER JOIN game.customer_settings cs ON cs.id = ph.player_id
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE player_id = $1)));
-- 4 degrees of separation
SELECT player_id, ps.player_state, ps.email, ph.create_date
FROM game.phone_hashes ph
INNER JOIN game.customer_settings cs ON cs.id = ph.player_id
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE player_id = $1))));
-- 5 degrees of separation
SELECT player_id, ps.player_state, ps.email, ph.create_date
FROM game.phone_hashes ph
INNER JOIN game.customer_settings cs ON cs.id = ph.player_id
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE player_id = $1)))));
-- 6 degrees of separation
SELECT player_id, ps.player_state, ps.email, ph.create_date
FROM game.phone_hashes ph
INNER JOIN game.customer_settings cs ON cs.id = ph.player_id
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE hash IN
(SELECT hash FROM game.phone_hashes
WHERE player_id = $1))))));