[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How can I do this update statement?

Posted on 2016-08-11
2
Medium Priority
?
70 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 2000 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

649 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