Solved

update with where and another select - doubt

Posted on 2012-04-04
2
263 Views
Last Modified: 2012-04-04
Hello Guys

I have a table with prod_code and supplier_code.

I want to update my main table only when my prod_code and supplier_code is found in my table B

I am having doubt to assemble this

update siaprod set pro_pven where exists (select * from table B)

my siaprod has two field that has in table B

how can I do this?

Thanks
0
Comment
Question by:hidrau
2 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 37806822
Please try:
update siaprod
 set pro_pven = << value to update >>
from siaprod s
inner join tableB b on s.prod_code = b.prod_code and s.supplier_code = b.supplier_code

Open in new window

0
 
LVL 1

Author Closing Comment

by:hidrau
ID: 37807390
thanks very much
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
SQL Backup skipping a few tables 7 51
Restrict result set 1 39
Strange msg in the SSMS pane 13 58
My Query is not giving correct result. Please help 5 51
There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

827 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