Guest_imported
New member
- Jan 1, 1970
- 0
I am trying to use the following select query in my SQR program. This query works perfect and produces the desired result when I use in my analyzer. But when I include it in my SQR it throws an error at CASE..... do lemme know how to build the BEGIN-SELECT/END-SELECT for this query.
lemme remind you I built it already with so many options but it throws an error in one or the other way around CASE.
SELECT B.DESCR,
(CASE WHEN IsNull(CBT.CRSE_RATE_ID,'')=''
THEN CBT.AMT_PER_UNIT
ELSE R.AMT_PER_UNIT
END) AS AMT_PER_UNIT,
(CASE WHEN IsNull(CBT.CRSE_RATE_ID,'')=''
THEN CBT.FLAT_AMT
ELSE R.FLAT_AMT
END) AS FLAT_AMT,
CBT.CRSE_RATE_ID
FROM PS_CLASS_SBFEE_TBL CBT
INNER JOIN PS_ITEM_TYPE_TBL B ON CBT.ITEM_TYPE=B.ITEM_TYPE AND CBT.SETID=B.SETID
LEFT JOIN PS_CRSE_RATE_TBL R ON CBT.CRSE_RATE_ID=R.CRSE_RATE_ID AND CBT.SETID=R.SETID
WHERE CBT.SETID = 'MATC1'
AND CBT.STRM = '1014'
AND CBT.CRSE_ID = '000562'
AND CBT.CRSE_OFFER_NBR = '1'
AND (R.ACAD_GROUP='ASSOC' OR IsNull(R.ACAD_GROUP,'')='')
lemme remind you I built it already with so many options but it throws an error in one or the other way around CASE.
SELECT B.DESCR,
(CASE WHEN IsNull(CBT.CRSE_RATE_ID,'')=''
THEN CBT.AMT_PER_UNIT
ELSE R.AMT_PER_UNIT
END) AS AMT_PER_UNIT,
(CASE WHEN IsNull(CBT.CRSE_RATE_ID,'')=''
THEN CBT.FLAT_AMT
ELSE R.FLAT_AMT
END) AS FLAT_AMT,
CBT.CRSE_RATE_ID
FROM PS_CLASS_SBFEE_TBL CBT
INNER JOIN PS_ITEM_TYPE_TBL B ON CBT.ITEM_TYPE=B.ITEM_TYPE AND CBT.SETID=B.SETID
LEFT JOIN PS_CRSE_RATE_TBL R ON CBT.CRSE_RATE_ID=R.CRSE_RATE_ID AND CBT.SETID=R.SETID
WHERE CBT.SETID = 'MATC1'
AND CBT.STRM = '1014'
AND CBT.CRSE_ID = '000562'
AND CBT.CRSE_OFFER_NBR = '1'
AND (R.ACAD_GROUP='ASSOC' OR IsNull(R.ACAD_GROUP,'')='')