I have a table (Table1) that has an ID that is shared from multiple-inserts:

ID | RefID | Field_Name | Field_Value | Type 1 | 1 | NumbAmt | 1111 | INT 2 | 1 | LocAdd | 123 Street | String 3 | 1 | LocDesc | Something | String 4 | 1 | LocHidden | Useless | Hidden

I can't use the ID since it is made from the inserts, the RefID is the main thing used to narrow down this data to all those with the RefID = 1 AND Type != 'Hidden'.

Whenever I do a case statement query:

SELECT CASE WHEN Field_Name = 'NumbAmt' THEN Field_Value END Amt, CASE WHEN Field_Name = 'LocAdd' THEN Field_Value END Address, CASE WHEN Field_Name = 'LocDesc' THEN Field_Value END Description FROM Table1 WHERE RefID = 1 AND Type IN ('INT','String')

It returns the results like:

Amt | Address | Description 1111 | NULL | NULL NULL | 123 Street | NULL NULL | NULL | Something

My question is, how would I gather all the data but have it split into separate columns without all the NULLs showing? (My assumption leads me to believe a temp table)

Or show up like: