Solved

How can I do this update statement?

Posted on 2016-08-11
2
51 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Closing database connection after prepared statement 1 54
selecting date modified field from a table 2 46
CheckListBox usage 3 59
sql_mode 1 24
I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
Creating and Managing Databases with phpMyAdmin in cPanel.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

832 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