SQL Statement

Posted on 2014-04-03
Last Modified: 2014-04-03
update SALESLINE set OrderStatus = 1
from SALESLINE  as a
inner join SALESTABLE as d
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 ?

Question by:AXISHK
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 143

Accepted Solution

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

Assisted Solution

Rgonzo1971 earned 167 total points
ID: 39974531

from which table is the order status a or d

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

LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 166 total points
ID: 39975789
No.  It will update to 1 if the order status is 0 and any line with order line status = 9 exists.

Author Closing Comment

ID: 39977000

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
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.

691 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