I have a table called Forms with fields ID, FormName and a couple of other fields.

I have another table called FormFields which has the FormId as a foreign key as well as an ID and a FieldName and FieldValue fields.

The idea is that this should be able to save and retrieve data for generic forms.

How can i get all the data from the Forms table and have all the data relevant to a the right FormId?

E.g. I want it to return the row with a column "FormData" that can store all the data from the FormFields table.

I'm using SQL Server