I'm still very new here and I have a very limited knowledge in any sql query. I am helping my company to create a database to store "Painting Reports" using LibreOffice Base. I have create a table which has more than 12 columns/fields to store the report.
My current table:
+----------+----------+------------+-----------+-----------+---------+-----------------+
| ReportID | nthCoat | DateCoat | NameCoat | Shade | BatchNo | __more_fields__ |
+----------+----------+------------+-----------+-----------+---------+-----------------+
| 1 | 1st Coat | 01/01/2020 | Luxaprime | Red Oxide | B75489 | value |
+----------+----------+------------+-----------+-----------+---------+-----------------+
| 1 | 2nd Coat | 02/01/2020 | Epilux | Grey | B98731 | value |
+----------+----------+------------+-----------+-----------+---------+-----------------+
| 1 | 3rd Coat | 03/01/2020 | Luxol | Yellow | B78937 | value |
+----------+----------+------------+-----------+-----------+---------+-----------------+
Since the table has too many columns/fields, it is not presentable in the generated report.
Hence, I would like to pivot the table to something like this:
+-----------------+------------+------------+------------+
| nthCoat | 1st Coat | 2nd Coat | 3rd Coat |
+-----------------+------------+------------+------------+
| DateCoat | 01/01/2020 | 02/01/2020 | 03/01/2020 |
+-----------------+------------+------------+------------+
| NameCoat | Luxaprime | Epilux | Luxol |
+-----------------+------------+------------+------------+
| Shade | Red Oxide | Grey | Yellow |
+-----------------+------------+------------+------------+
| BatchNo | B75489 | B98731 | B78937 |
+-----------------+------------+------------+------------+
| __more_fields__ | value | value | value |
+-----------------+------------+------------+------------+
By pivoting the table, it can accommodate the numerous columns/fields and more presentable in report. The values of "nthCoat" are fixed to 1st, 2nd and 3rd Coat.
There is no calculation of values needed. All the values are mainly varchar fields.
Can someone please help me pivot the table? Thanks in advance.
I have spent hours and tried to search the site for any existing solution but most of them involve calculations with complex query which is too much for beginner like me to understand.