Table Pivot Question

They have: 2 posts

Joined: Jan 2003

Hello. I've looked all over for answers for this question but no one seems to have a good answer. So here it is.

I have two tables with the following fields:

tblA tblB
------------- -----------------
RID (ReportID) RID
CID (ColumnID) CID
Order Row
Name Value

values might contain something like this:

tblA
======
RID CID Order Name
----- ------ ------- -------
1 1 1 FName
1 2 2 LName
1 3 3 Address

tblB
======
RID CID Row Value
----- ------ ------- -------
1 1 1 fred
1 2 1 smith
1 3 1 123 st
1 1 2 jane
1 2 2 doe
1 3 2 abc st

Heres my problem. I have X number of customers that want different columns for their tables that they can change at any time. So tblA defines those fields acting as meta data. And tblB contains the values for those fields. So what I can't figure out is if there's a way to make this row based data turned into column based data. So that it might look something like this.

FName LName Address
------- ---------- -----------
fred smith 123 st
jane doe abc st

Please someone help!!
Thank you.
Dan

They have: 2 posts

Joined: Jan 2003

Sorry, I couldn't get the values to space out correctly.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.