'how to insert multiple data in single column

+----------+-----------+---------+------------+------------+-----------+
| issue_id | person_id | book_id | issue_date | due_date   | status    |
+----------+-----------+---------+------------+------------+-----------+
|        1 |         1 |       2 | 2022-04-24 | 2022-04-29 | returned  |
|        2 |         3 |       5 | 2022-04-24 | 2022-04-30 | pending   |
|        3 |         3 |       2 | 2022-04-24 | 2022-04-29 | pending   |
|        4 |         2 |       4 | 2022-04-24 | 2022-04-29 | returned  |
|        5 |         6 |      10 | 2022-04-28 | 2022-05-03 | pending   |
|        6 |         1 |       4 | 2022-04-23 | 2022-04-25 | defaulter |
|        8 |         3 |       4 | 2022-04-26 | 2022-04-26 | pending   |
+----------+-----------+---------+------------+------------+-----------+

this is my actual records but I want results where a person with multiple books will be shown as-> person-3, books- 5,2,4 which are pending, and if status like 'returned or defaulter' for the same person should have a separate entry.

+----------+-----------+-----------------------+------------+------------+---------+
| issue_id | person_id | group_concat(book_id) | issue_date | due_date   | status  |
+----------+-----------+-----------------------+------------+------------+---------+
|        2 |         3 | 5,2,4                 | 2022-04-24 | 2022-04-30 | pending |
|        5 |         6 | 10                    | 2022-04-28 | 2022-05-03 | pending |
+----------+-----------+-----------------------+------------+------------+---------+

how can I add a record with status return and defaulter in the above result?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source