It is better to follow Normalization rules as this is a One to Many relationship.
I have created two tables here
1.users
create table users(
id int not null auto_increment,
name varchar(40) not null,
primary key(id)
);
insert into users( name) values ('John'),('Mike'),('Sarah');
+----+-------+
| id | name |
+----+-------+
| 1 | John |
| 2 | Mike |
| 3 | Sarah |
+----+-------+
2.partners
create table users(
id int not null auto_increment,
name varchar(40) not null,
primary key(id)
);
insert into partners values (2,1),(2,3),(3,1),(3,2);
+---------+------------+
| user_id | partner_id |
+---------+------------+
| 2 | 1 |
| 3 | 1 |
| 3 | 2 |
| 2 | 3 |
+---------+------------+
You can use the following query to select Users and their partner
select u.name Users, group_concat(u1.name) Partners from users u
left join partners p on u.id = p.user_id
left join users u1 on p.partner_id = u1.id
group by Users;
Output:
+-------+------------+
| Users | Partners |
+-------+------------+
| John | NULL |
| Mike | John,Sarah |
| Sarah | John,Mike |
+-------+------------+