Hi all,
Here's what I'm trying to do. First, I have a table like this:
I am trying to create a sql statement that returns this data rearranged into a table that utilizes the Class for its headers so it looks like this:
I'm attempting to use a
but can't seem to wrap my head around what I'll need to do to populate the temp table. The issue is there could be many different 'Class'es and I want the columns returned to be dynamic according to however many Classes are set and using the Field_ID for the primary key of the newly created table. Hope that makes sense (its late). Thanks for any help!
Here's what I'm trying to do. First, I have a table like this:
Code:
_________ ________ _____ _____
[prime_key] [Field_ID] [Field] [Class]
--------- -------- ----- -----
1 1A 'foo' 'A'
2 2A 'bar' 'A'
3 1A 'tst' 'B'
4 3A 'hi.' 'B'
I am trying to create a sql statement that returns this data rearranged into a table that utilizes the Class for its headers so it looks like this:
Code:
________ _ _
[Field_ID] [A] [B]
-------- ----- -----
1A 'foo' 'tst'
2A 'bar' null
3A null 'hi.'
I'm attempting to use a
Code:
CREATE TEMPORARY TABLE Temp SELECT ????