I need a solution for following Problem. I have two Tables:
ids from new user (got by subquery)
+------------+
|  user_id   |
+------------+
| 1          | 
| 4          | 
| 5          |
+------------+
users (table with all users)
+------------+
|  user_id   |
+------------+
| 1          | 
| 2          | 
| 3          |
| 4          |
| 5          |
| ...        |
+------------+
i need to join this two tables. every new user needs exactly 3 connections to other users.
for example:
+----------+------+
| new_user | user |
+----------+------+
| 1        | 2    |
| 1        | 3    |
| 1        | 4    |
| 4        | 1    |
| 4        | 2    |
| 4        | 3    |
| 5        | 1    |
| 5        | 2    |
| 5        | 3    |
+----------+------+
the problem is to limit the entries to exactly 3 and to exclude redundant entries (like 1|1, 3|3, ...)
 
    