Solved

How can I do this update statement?

Posted on 2016-08-11
2
37 Views
Last Modified: 2016-08-18
I've got a "features" table with a "part_number" column in it that needs to be updated according to the "feature_door_id" column in the "doors" table.

There isn't a real relationship between those two tables, however...

There's a "product_id" column in the "products" table that can help, I just don't know how to structure this update statement that makes the correct association.

It looks like this:

spreadsheet image
I want to use the relationship that exists between the three tables to help me update what's in the "featured_door_id" column to the "part_number" column in the features table.

How?
0
Comment
Question by:brucegust
2 Comments
 
LVL 12

Accepted Solution

by:
funwithdotnet earned 500 total points
ID: 41753211
Maybe I missed something. It looks like you have a related product_id column in both the doors and features tables.

If that is the case, in T-SQL it would look like this:

UPDATE f
SET f.part_number = d.featured_door_id
FROM [featurestable] f
INNER JOIN [doorstable] d ON d.product_id = f.product_id

Open in new window


Good luck!
0
 

Author Comment

by:brucegust
ID: 41760848
I figured it out, fun!

Thanks for your help!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 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

19 Experts available now in Live!

Get 1:1 Help Now