Please accept my apologies if this has been asked in the past but I have been through the questions and can't find the answer.
I have a table with multiple entries as follows:
key | type | Code | Date
1234 | S | 10DY | 01/10/2012
1234 | E | 10DY | 31/10/2012
12376 | S | 10DY | 11/10/2012
12376 | E | 10DY | 21/10/2012
I would like to extract the data so that it appears as follows:
key | Code | S_Date | E_Date
1234 | 10DY | 01/10/2012 | 31/10/2012
12376 | 10DY | 11/10/2012 | 21/10/2012
Currently I have this:
SELECT key, code, CASE WHEN type = 'S' THEN Date END AS S_Date,
CASE WHEN type = 'E' THEN Date END AS E_Date
FROM Table1
WHERE code = '10DY'