Solved

Update field using data in another table

Posted on 2015-01-02
8
120 Views
Last Modified: 2015-01-02
I have a table called DEC DATA, it has a field named prodcat.  I have another table called CROSS REF and it has a field named productline that matches the field named prodcat from the DEC DATA table. The CROSS REF table also has another field called prodcat which contains the data I want to update/replace the value for prodcat on my DEC DATA TABLE when prodcat is the same as productline.
0
Comment
Question by:ector73
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 33

Expert Comment

by:Mike Eghtebas
ID: 40528535
Update [CROSS REF] c Set c.prodcat = (Select d.prodcat  From [DEC DATA] d Where  d.prodcat = c.productline)
0
 
LVL 18

Expert Comment

by:SimonAdept
ID: 40528540
From your description:

UPDATE [DEC DATA]  INNER [CROSS REF]  ON [DEC DATA].prodcat=[CROSS REF].productline
SET [DEC DATA].prodcat=[CROSS REF].prodcat

Hmm.. I see that eghteas beat me to it but interpreted your requirement differently. Not sure which table you actually wanted to update.
0
 
LVL 33

Expert Comment

by:Mike Eghtebas
ID: 40528541
I think you meant this:

UPDATE [CROSS REF]  INNER [DEC DATA]  ON [DEC DATA].prodcat=[CROSS REF].productline
SET [CROSS REF].prodcat=[DEC DATA].prodcat
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 40528543
try this query


update [DEC DATA] inner join [CROSS REF]
on [DEC DATA].productline = [CROSS REF].prodcat
set [DEC DATA].prodcat = [CROSS REF].prodcat
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:ector73
ID: 40528556
I am getting a syntax error on Join operation
0
 

Author Comment

by:ector73
ID: 40528558
If I use eghtebas solution I get a pop up screen asking for a parameter.
0
 
LVL 33

Expert Comment

by:Mike Eghtebas
ID: 40528562
UPDATE [CROSS REF]  INNER JOIN [DEC DATA]  ON [DEC DATA].prodcat=[CROSS REF].productline
SET [CROSS REF].prodcat=[DEC DATA].prodcat
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 40528583
ector73

try my post at http:#a40528543
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

757 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

24 Experts available now in Live!

Get 1:1 Help Now