Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a sql script that loads data for reporting. I would like to alias the data in one of the fields so that the output is slightly different. if I do not use the field below (in blue) the data loads perfectly. What am I doing incorrectly here?
SQL SELECT DISTINCT substr(PAIDDATE,1,6),
PAIDMONTH,
COUNTYCODE = CASE
WHEN A.GROUPCODE='HCBUC' THEN 'BUCKS'
WHEN A.GROUPCODE='HCDLW' THEN 'DELAWARE'
WHEN A.GROUPCODE='HCMTG' THEN 'MONTGOMERY'
END,
A.GROUPCODE,
RATEGROUPDESC,
PROVIDERMISID,
A.SERVICECATEGORYCODE,
SERVICECATEGORYDESC,
SERVICESTARTMONTH,
PAIDDATE,
TOTALPAIDAMOUNT,
UNIQUEMEMBERCOUNT,
UNITS,
PAIDAMOUNT
FROM TBL1 A, TBL2 B, TBL3 C
WHERE PAIDDATE between 20180701 and 20180731
AND A.RATEGROUPCODE = B.RATEGROUPCODE
AND A.SERVICECATEGORYCODE = SUBSTR(C.SERVICECATEGORYCODE,1,2)
ORDER BY substr(PAIDDATE,1,6),A.GROUPCODE, PROVIDERMISID,RATEGROUPDESC, PAIDDATE;
Depends on the SQL you're using, but should be actually something like
case COUNTYCODE
when 'HCBUC' THEN 'BUCKS'
when 'HCDLW' THEN 'DELAWARE'
when 'HCMTG' THEN 'MONTGOMERY'
end
Felipe.
Depends on the SQL you're using, but should be actually something like
case COUNTYCODE
when 'HCBUC' THEN 'BUCKS'
when 'HCDLW' THEN 'DELAWARE'
when 'HCMTG' THEN 'MONTGOMERY'
end
Felipe.
yes that was it...silly mistake. thank you!