Ok, this is annoying me, so I thought I'd try here, since a few of you might have some spare time,
I wrote a SQL Query to pivot a table using CASE statements,
I now have a table that looks like this
FIRST NAME | MIDDLE NAME | LAST NAME | OPTION 1 | OPTION 2 | OPTION 3 (all the way to 285, but this changes)
Adriaan | Jack | Egg | Yes | null | null
Adriaan | Jack | Egg | null | 34 | null
Adriaan | Jack | Egg | null | null | x
Joe | | Bob | No | null | null
Joe | | Bob | null | 31 | null
Joe | | Bob | null | 34 | null
Joe | | Bob | null | 36 | null
Joe | | Bob | null | 37 | null
Joe | | Bob | null | 11 | null
Joe | | Bob | null | null | yx
How do I collapse the table into the least amount of records, I can't use aggregate functions as certain columns, e.g. OPTION 2, can have more than one value down.
I want to end up with a table like this:
Adriaan | Jack | Egg | Yes | 34 | x
Adriaan | Jack | Egg | Yes | 34 | x
Joe | | Bob | No | 31 | xy
Joe | | Bob | null | 34 | null
Joe | | Bob | null | 36 | null
Joe | | Bob | null | 37 | null
Joe | | Bob | null | 11 | null
I wrote a SQL Query to pivot a table using CASE statements,
I now have a table that looks like this
FIRST NAME | MIDDLE NAME | LAST NAME | OPTION 1 | OPTION 2 | OPTION 3 (all the way to 285, but this changes)
Adriaan | Jack | Egg | Yes | null | null
Adriaan | Jack | Egg | null | 34 | null
Adriaan | Jack | Egg | null | null | x
Joe | | Bob | No | null | null
Joe | | Bob | null | 31 | null
Joe | | Bob | null | 34 | null
Joe | | Bob | null | 36 | null
Joe | | Bob | null | 37 | null
Joe | | Bob | null | 11 | null
Joe | | Bob | null | null | yx
How do I collapse the table into the least amount of records, I can't use aggregate functions as certain columns, e.g. OPTION 2, can have more than one value down.
I want to end up with a table like this:
Adriaan | Jack | Egg | Yes | 34 | x
Adriaan | Jack | Egg | Yes | 34 | x
Joe | | Bob | No | 31 | xy
Joe | | Bob | null | 34 | null
Joe | | Bob | null | 36 | null
Joe | | Bob | null | 37 | null
Joe | | Bob | null | 11 | null