Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL Update Statment Help

$
0
0

We have a sql query that shows all jobs that are COMPLETED, but not CLOSED

Query is -

select
  [JobHead].[JobClosed] as [JobHead_JobClosed],
  [JobHead].[JobComplete] as [JobHead_JobComplete]
from Erp.JobHead as JobHead
inner join Erp.JobProd as JobProd on
  JobHead.Company = JobProd.Company
  and JobHead.JobNum = JobProd.JobNum
  and ( JobProd.ShippedQty > 0 or JobProd.ReceivedQty > 0 )

where (JobHead.JobComplete = 1 and JobHead.JobClosed <> 1)

--

We want to update the JobHead.JobClosed value to be 1 for all records returned in this select statement

How can we do that with an Update statement when we have a join and where condition?


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>