Hello group,
First time post..
I've designed an online evaluation script (php/mssql) and need help either writing a query to get the posted data out in a way that is useable to those collecting the evaluations..
Here are the tables.
evaluations - holds a record for each evauation that is created:
evalID, evalName
fields - holds a record for each potential field that could be added to the evaluation:
fieldID, fieldTitle, fieldDescription, and fieldTypeID (types are in a seperate table)
fields_evals - contains the link between the evaluations table and the fields table. this one essentially creates teh evaluation from the eval name and the list of fields. it also contains some switches that specify how the data should be reported (i.e. averaged and/or grouped by) and values that determine if the fields are required and what position they are to be listed in the evaluation form.. (hope that made sense) :
evalID, FieldID, position, required, groupby, average
fields_custom - one of the field types is a custom field where the user can create a field with a list of options (i.e. Jan, Feb, Mar, April.... or whatever they like) :
optionID, optionText, fieldID
submitted - holds data for each individual submitted eval..:
subID, timestamp, and evalID
eval_data - this is the biggie.. this is the table that all the responses are written to. it has these fields...
data_ID, subID, fieldID, data
Here's the problem..
I want the report page to be able to summraize the data by grouping by the data set in the eval_fields table.. (a row for each value submitted) and on that row have all of the averaged fields (again indicated from the eval_fields table) listed with their averages.. all of the data will come from the eval_data table.. possibly including (and i think this may be the main problem) an id value that relates to the optionID in teh custom_fields table.
an example of a posted evaluation will create:
1 row in the submitted table..
and a row in the eval_data table for each field submitted..as well as
with any luck this explanation makes sense and the problem will be easy to solve..
any replys are greatly appreciated..
Thanks
Will