So I have a case statement that I'm trying to figure out, and ultimately I don't think I have to do this as a case, but I tried doing it as a sub-query within the select statement and that did not work.
SELECT ID.ID_VALUE AS ID,
(CASE WHEN OBJ.STATUSCD = 'TEST' THEN TO_CHAR(OBJ.DTTM,'MM/DD/YYYY') END)
AS TEST_DATE,
(CASE WHEN OBJ.STATUSCD = 'NON-T' THEN TO_CHAR(OBJ.DTTM,'MM/DD/YYYY') END)
AS NON-T_DATE
When I processes this, I end up with a result that contains 3 columns and 2 rows. The one row contains a TEST_DATE value in one column, and nothing in another. Then in the other row I have a value in NON-T_DATE and nothing in another cell. The ID values are the same so I don't know why I can't get the results in the same row without duplicates.
Here's an example of my results:
|| ID || TEST_DATE || NON-T_DATE ||
|| 10 || 1/1/2015 || NULL ||
|| 10 || NULL || 1/2/2015 ||
Aucun commentaire:
Enregistrer un commentaire