SQL Statement

update SALESLINE set OrderStatus = 1
from SALESLINE  as a
inner join SALESTABLE as d
on a.SALESID = d.SALESID
where a.ORDERSTATUS = 9
and d.ORDSTATUS = 0;

For the statement above, a group of Sales transaction (with same SALESID) and include either OrderStatus =9 or 0, it's OrderStatus will be updated with OrderStatus = 1.

Am I correct ?

Tks
AXISHKAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
no. it will update to 1 if the status was 9, and a orderline status of 0 exists
0
 
Rgonzo1971Connect With a Mentor Commented:
Hi

from which table is the order status a or d

and use Or insteat of And if you want either 0 or 9

Regards
0
 
Scott PletcherConnect With a Mentor Senior DBACommented:
No.  It will update to 1 if the order status is 0 and any line with order line status = 9 exists.
0
 
AXISHKAuthor Commented:
Tks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.