I had to do a complicated subquery in order to get my results. There's no native way to read the field_number values from the wp_rg_form table to get the column names. Essentially the problem is that Gravity Forms allows for dynamic tables by creating rows in the wp_rg_lead_detail table. To display your rows as a column you have to do a row to column, pivot table. To achieve this a sub query is required. My query ended up looking like this mess:
1) I created a view called 'bjj'
create view bjj as select * from wp_rg_lead_detail where form_id=1
2) My query looked like this madness:
Since GF uses floats for the field_number you have to accomodate by doing the ugly round(...). You have to know firsthand what your field_numbers map to. In my case I had to manually examine the field_number/values pair to find out what they were mapped to (e.g. 66.0 mapped to the age column).
Hope that helps you out.
Posted 13 years ago on Monday March 19, 2012 |
Permalink