Solved

SQL Statement

Posted on 2014-04-03
4
274 Views
Last Modified: 2014-04-03
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
Comment
Question by:AXISHK
4 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 167 total points
Comment Utility
no. it will update to 1 if the status was 9, and a orderline status of 0 exists
0
 
LVL 48

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 167 total points
Comment Utility
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
 
LVL 69

Assisted Solution

by:ScottPletcher
ScottPletcher earned 166 total points
Comment Utility
No.  It will update to 1 if the order status is 0 and any line with order line status = 9 exists.
0
 

Author Closing Comment

by:AXISHK
Comment Utility
Tks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now