0% found this document useful (0 votes)
5 views1 page

SQL Query for Prestac Orders

The document contains a SQL query that retrieves employee codes, emission dates, and monetary values from four different tables based on specific conditions. It filters records where the order description includes 'PRESTAC', the status is 'I', and matches employee codes from a separate table. The results are combined using UNION and are intended to be ordered by monetary values, although the ordering is commented out.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

SQL Query for Prestac Orders

The document contains a SQL query that retrieves employee codes, emission dates, and monetary values from four different tables based on specific conditions. It filters records where the order description includes 'PRESTAC', the status is 'I', and matches employee codes from a separate table. The results are combined using UNION and are intended to be ordered by monetary values, although the ordering is commented out.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

select [Link],[Link],[Link]/1000,'001' from sima004.

opordpag a,NPASICAREMP B
where --[Link] like '%14120018%' and
desord like '%PRESTAC%' AND [Link]='I'
AND TRIM([Link])=TRIM([Link]) AND [Link]='023'
UNION
select [Link],[Link],[Link]/1000,'001' from [Link] a,NPASICAREMP B
where --[Link] like '%14120018%' and
desord like '%PRESTAC%' AND [Link]='I'
AND TRIM([Link])=TRIM([Link]) AND [Link]='023'
UNION
select [Link],[Link],[Link]/1000,'001' from [Link] a,NPASICAREMP B
where --[Link] like '%14120018%' and
desord like '%PRESTAC%' AND [Link]='I'
AND TRIM([Link])=TRIM([Link]) AND [Link]='023' --ORDER BY MONORD DESC --ORDER
BY MONORD DESC
UNION
select [Link],[Link],[Link]/1000,'001' from [Link] a,NPASICAREMP B
where --[Link] like '%14120018%' and
desord like '%PRESTAC%' AND [Link]='I'
AND TRIM([Link])=TRIM([Link]) AND [Link]='023' --ORDER BY MONORD DES

You might also like