I have the following tables:
Dataentry
---------
name
id
DataentryRows
----------
id
dataentry_id
Fields
----------
dataentry_id
name
id
DataentryValue
----------
id
value
field_id
dataentry_row_id
I want to create a query to retrieve all the DataentryRows of a dataentry, where a DataEntryRow should includes all the fields name and the specific value.
The issue I am facing is that the number of fields is dynamic and I want to produce a column for each field of a dataentry.
Example data: http://sqlfiddle.com/#!9/9c1f66