Multi query with group by , join them in different columns One table has different columns for each column I want to do a group by function. I get unique values for each column in the table.

Origin Table data:

+----+--------------+--------------+
| id | customername | amazonnumber |
+----+--------------+--------------+
|  1 | Mark         |         1122 |
|  2 | Pieter       |         1122 |
|  3 | Jean         |         1122 |
|  4 | Jean         |         1122 |
|  5 | Janis        |         1123 |
|  6 | Janis        |         1123 |
+----+--------------+--------------+


At this moment i do this:

SELECT customername FROM tablegroup  group by customername; 
SELECT amazonnumber FROM tablegroup  group by amazonnumber;


This is great i get for each column the unique value.

I want to combine them so i get all the data vertical in columns.
I have tried this but, this give not the right results:

SELECT * FROM 
(SELECT customername FROM tablegroup  group by customername) b
 CROSS JOIN
(SELECT amazonnumber FROM tablegroup  group by amazonnumber) c;


This is the wrong result:

+---------------+--------------+
| customername  | amazonnumber |
+---------------+--------------+
| Mark          |        11222 |
| Pieter        |        11222 |
| Jean          |        11222 |
| Janis         |        11222 |
+---------------+--------------+


End Result:

+---------------+--------------+
| customername  | amazonnumber |
+---------------+--------------+
| Mark          |        11222 |
| Pieter        |        11223 |
| Jean          |              |
| Janis         |              |
+---------------+--------------+
For MySQL 8+:

WITH RECURSIVE
cte1 AS ( SELECT customername, ROW_NUMBER() OVER () rn
          FROM tablegroup
          GROUP BY customername 
        ),
cte2 AS ( SELECT amazonnumber, ROW_NUMBER() OVER () rn 
          FROM tablegroup
          GROUP BY amazonnumber 
        ),
cte3 AS ( SELECT 1 num
          UNION ALL
          SELECT num+1 
          FROM cte3
          WHERE num &lt; ( SELECT GREATEST(cnt1, cnt2)
                        FROM ( SELECT COUNT(*) cnt1
                               FROM cte1
                             ),
                             ( SELECT COUNT(*) cnt2
                               FROM cte2
                             )
                      )
        )
SELECT cte1.customername, cte2.amazonnumber
FROM cte3
LEFT JOIN cte1 ON cte3.num = cte1.rn
LEFT JOIN cte2 ON cte3.num = cte2.rn