Advertisement

03.25.2008 at 02:26PM PDT, ID: 23268708
[x]
Attachment Details

Sql update query question

Asked by LeeHopkins in MS SQL Server

Tags: TSQL

I have a query that does some calculations from two tables and I want to up date one of the tables valus from the result of that query.  now how do i update the stock table field [quanity in stock] and altinstkqty from this query where [stock id] = [stock id]
SELECT
Stock.[Stock ID],
Case when tbl_RESPAR_REPLACE.RESPAR_QTY_MFG > 0 then
Stock.[Quanity in Stock] - tbl_RESPAR_REPLACE.RESPAR_QTY_MFG
else 0
end as newMfgQTy,
Case when tbl_RESPAR_REPLACE.RESPAR_QTY_ALT > 0 then
Stock.AltInStkQty - tbl_RESPAR_REPLACE.RESPAR_QTY_ALT
else 0
end as newAltQty
FROM tbl_RESPAR_REPLACE INNER JOIN
 Stock ON tbl_RESPAR_REPLACE.RESPAR_STOCKID = Stock.[Stock ID]
WHERE     (tbl_RESPAR_REPLACE.RESPAR_RESREQID = 1)
Start Free Trial
[+][-]03.25.2008 at 02:37PM PDT, ID: 21206510

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.25.2008 at 02:39PM PDT, ID: 21206527

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: TSQL
Sign Up Now!
Solution Provided By: BriCrowe
Participating Experts: 2
Solution Grade: A
 
 
[+][-]03.25.2008 at 07:20PM PDT, ID: 21208417

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.23.2008 at 06:15AM PDT, ID: 21845833

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.27.2008 at 06:57PM PDT, ID: 21888835

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628