I ran the following query to determine open orders that should be voided. After reviewing and approving them, we need to know how we can void these orders using SQL. We have over 30K order #'s in this results set.
Thank you in advance.
Kathy
GP Novice
[blue]Kathy,
Bus Sys Analyst[/blue]
"I am always doing that which I can not do, in order that I may learn how to do it."– Pablo Picasso
The person who says it can't be done shouldn't interrupt the person who is doing it.—Chinese Proverb
SQL:
SELECT distinct ca.custname, ca.CUSTNMBR, datediff(day,getdate(),oh.ReqShipDate) Age,
oh.ReqShipDate,oh.SOPNUMBE, ca.HOLD AcctHold, oh.SUBTOTAL
from RM00101 ca join SOP10100 oh on ca.CUSTNMBR = oh.CUSTNMBR
where ca.INACTIVE =0 AND oh.SOPTYPE=2 and oh.voidstts = 0
and oh.reqshipdate<(getdate()-90)
and not exists
(--order is not yet in the history table
select distinct b.* from sop10200 b where b.sopnumbe = oh.sopnumbe and b.soptype = 2 and b.qtyfulfi > 0
)
Kathy
GP Novice
[blue]Kathy,
Bus Sys Analyst[/blue]
"I am always doing that which I can not do, in order that I may learn how to do it."– Pablo Picasso
The person who says it can't be done shouldn't interrupt the person who is doing it.—Chinese Proverb