I've seen this SO question (How can I Pivot a table in DB2?) and some of the answers/comments mention being able to acheive the same effect with a case statement but I'm struggling mightily to acheive this, probably due to a few years away from much SQL.
Here is a snapshot of some data I have:
ID Date ErrID ErrDesc
---------------------------------------
164 2012-09-21 1402 Large V
164 2012-09-21 1409 Missing
416 2012-09-21 1409 Missing
1380 2012-09-21 1411 n - Mis
1500 2012-09-17 1411 n - Mis
1500 2012-09-21 1402 Large V
ID and Date taken together need to be unique in a query that would return something such as the following, where the empty slots are null. How can I achieve this, with a case statement or otherwise? Bear in mind I don't think our version of DB2 supports "decode", and the SQL I need also needs to be able to run on Derby for testing. Thanks in advance.
ID Date Err1402 Err1409 Err1411
-----------------------------------------------------------------------
164 2012-09-21 Large V Missing
416 2012-09-21 Missing
1380 2012-09-21 n - Mis
1500 2012-09-17 n - Mis
1500 2012-09-21 Large V