• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

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
0
AXISHK
Asked:
AXISHK
3 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
no. it will update to 1 if the status was 9, and a orderline status of 0 exists
0
 
Rgonzo1971Commented:
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 PletcherSenior 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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now