Combine multiple rows into one row with multiple columns

E

Elysia Larson

Hi,

I have a table set up so that there are three columns: StudyID,
DrawDate, and Value. StudyID and DrawDate are the primary key. I
want to create a table from this one that has only one row for each
StudyID so that it would go from:

StudyID DrawDate Value

to

StudyID DrawDate1 Value1 DrawDate2 Value2 DrawDate3
Value3 etc.

Is there a way to do this?

Thanks,

Elysia
 
P

PvdG42

Elysia Larson said:
Hi,

I have a table set up so that there are three columns: StudyID,
DrawDate, and Value. StudyID and DrawDate are the primary key. I
want to create a table from this one that has only one row for each
StudyID so that it would go from:

StudyID DrawDate Value

to

StudyID DrawDate1 Value1 DrawDate2 Value2 DrawDate3
Value3 etc.

Is there a way to do this?

Thanks,

Elysia

How many DrawDate fields will be needed per record? You are denormalizing
your data, and it will probably cause problems in the long run. If you have
multiple DrawDates associated with a single StudyID, you need a one-to-many
relationship between two tables to represent that relationship.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top