I’ve set up a particular form for which I need to be able to query the responses in the database directly so that these responses can be managed / edited. However, the way that the values are stored in the database is “vertically” in the meta_value column of the wp_gf_entry_meta table, which looks like, for example
| id | form_id | entry_id | meta_key | meta_value |
---------------------------------------------------
| 1234 | 52 | 1234 | 1.3 | Fred
| 1235 | 52 | 1234 | 1.6 | Flintstone
| 1236 | 52 | 1234 | 3 | fred@bedrock.com
| 1237 | 52 | 1234 | 4.3 | Pebbles
| 1237 | 52 | 1234 | 4.6 | Flintstone
I can relate the meta_keys to the questions in the form such that I know that 1.3 = Parent First Name, for example. I’m not a MYSQL expert by any means, but I know there must be a way to generate a editable pivot table or view that looks like the following with the rows transposed into columns with the meta_keys becoming column headers:
form_id | entry_id | 1.3 | 1.6 | 3 | 4.3 | 4.6
-----------------------------------------------------------------------------
52 | 1234 | Fred | Flintstone | fred@bedrock.com | Pebbles | Flintstone
This is basically exactly how the entries look in the Wordpress admin for the form, I just have no idea how to achieve the same with MYSQL query. Ideally the solution would create a VIEW so that the data can be manipulated.
Many many thanks…
Trevor