Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
am trying to get the following IF statement to work, and I'm not sure this is possible and if so, what I'm doing wrong. I have a couple of questions. Do I need a Group By function added to this? If so, where, because I've tried it several ways. Also, can this even be done the way I'm trying to do things?
GPAStatusTbl:
SQL SELECT * FROM SYSADM."PS_W_GPA_STS_TBL";
STORE * FROM GPAStatusTbl INTO $(vQVDFolder)\GPAStatusTbl.qvd;
DROP TABLE GPAStatusTbl;
LOAD
"W_GPA_ID" AS [IHR GPA ID],
ACTIONDTTM,
"W_GPA_STATUS",
IF(W_GPA_STATUS = 'IHV', MAX (ACTIONDTTM)) AS IHR_APP_1_DATE
FROM $(vQVDFolder)\GPAStatusTbl.qvd (qvd);
Thanks!
Try: MAX(IF(W_GPA_STATUS = 'IHV', ACTIONDTTM)) AS IHR_APP_1_DATE
And yes, you would need to group it by first 3 fields.
EDIT: And I think you need to use MAXSTRING and not MAX as W_GPA_STATUS seems to be a string.