-
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.
-
either that or have an additional column that somehow is autoassigned an identifier number to determine where that data came from and then process everything on the scripting side per row.
-
try with the CASE which is similar to DECODE with additional feature.
Here is the example:
select deptno,comm,(case when (deptno=10 or comm is null ) then 'test case' else 'test' end) from emp order by 2,1;
here the o/p will be
deptno comm case
10 test case
20 test case
10 800 test case
20 300 test
hope u got the point.
Srinivas Reddy Tatireddy
-
thanks man i appreciate it. hopefully this will do the trick =)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|