[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Update Statment Help using JOINS?

Posted on 2007-10-05
Medium Priority
Last Modified: 2010-03-20
Okay so I know how to select data from tables using Joins but how do I update whilst using this principle.

Eg.  I have 3 tables, 1: Stock, 2: StockToRecords, & 3: Records

I could do this in a select
SELECT records.recid from records
INNER JOIN StockToRecords ON Records.RecID = StockToRecords.RecID
INNER JOIN Stock ON StockToRecords.Partno = Stock.Partno
where Stock.Partno = 'banana'

So I can select based on the Stock table but how using this relation as above would I update a column in records using a where clause from stock?

Thanks in advance,

Question by:andrewmilner
LVL 75

Accepted Solution

Aneesh Retnakaran earned 2000 total points
ID: 20023156
SET urColumn = newValue

from records r
INNER JOIN StockToRecords ON r.RecID = StockToRecords.RecID
INNER JOIN Stock ON StockToRecords.Partno = Stock.Partno
where Stock.Partno = 'banana'

Author Comment

ID: 20047714
Spot On!!!

That's fantastic.  Thank you very much.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

873 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