SELECT SCHD2_REF,SCHD2_DATE,SCHD2_REC_TYPE,(SCHDQTY_REQ - SCHDQTY_ISS) AS QTYOUT
FROM SCHD_DATA
WHERE SCHD2_CO_SITE='10'
AND SCHD2_PART='02-086'
AND SCHDSTATUS='0'
AND SCHDQTY_REQ > SCHDQTY_ISS
UNION ALL
SELECT SUGG2_REF,SUGG2_DATE,SUGG2_REC_TYPE,SUGGQTY_REQ
FROM SUGG_DATA
WHERE SUGG2_CO_SITE='10'
AND SUGG2_PART='02-086'
ORDER BY 2;


I need to be able to change the QTYOUT and SUGGQTY_REQ values based on the SCHD2_REC_TYPE and SUGG2_REC_TYPE fields. There anyway to do this right in the sql or do i have to created some kinda outside procedure.

I would just do this with my scripts afterward. But the circumstances restrict me.