Solved

How can I do this update statement?

Posted on 2016-08-11
2
65 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
[X]
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
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

726 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