Solved

simple Update query

Posted on 2006-07-06
11
283 Views
Last Modified: 2008-02-01
Sorry Brain freeze - Help with simple Update query

Easy 500 Points for the right answer.

I always get this confused.

I want to update the Cardtype in table 1 with the value of Cardtype in table2 where the month =0 and the regions match.

What is the correct syntax.

thanks,

Karen
0
Comment
Question by:Karen Schaefer
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 35

Assisted Solution

by:Raynard7
Raynard7 earned 250 total points
ID: 17055160
UPDATE table1 INNER JOIN table2 ON table1.region = table2.region  SET table1.cardtype = table2.cardtype
WHERE (((table2.month)="0"));
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 17055183
?
UPDATE Table1 INNER JOIN Table2 ON Table1.Region = Table2.Region SET Table1.CardType = Table2.CardType WHERE (((Table2.month)=0));
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 17055185
sorry Ray...I'm too slow!
:o)
0
 

Author Comment

by:Karen Schaefer
ID: 17055192
Sorry I always get mixed up which table is table1 the table the data is being updated or the table where the data is coming from?

K
0
 

Author Comment

by:Karen Schaefer
ID: 17055199
My tables names are

UMA_SUBS.cardtype data I want to update
UMAPERF_MN.WSSCARDTYPE where the data is coming from.

Thanks,

K
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 35

Expert Comment

by:Raynard7
ID: 17055207
UMA_SUBS.cardtype data I want to update - table 1
UMAPERF_MN.WSSCARDTYPE where the data is coming from. - table 2 (as this has the where statement)
0
 

Author Comment

by:Karen Schaefer
ID: 17055240
M_region       M_Node        Load Type      Month      UMA_Subs      CardType
Atlanta       ATMSS995       MSS/UNC      0      3554      
Chicago       CHMSS965       MSS/UNC      0      3554      
Seattle       SEMSS994       MSS/UNC      0      3554      
Houston       HNMSS983       MSS/UNC      0      53554      
Orlando       ORMSS963      MSS/UNC      0      153554      
Denver       DNMSS935       MSS/UNC      0      253554      
Detroit       DEMSS931       MSS/UNC      0      153554      
Dallas       DAMSS986       MSS/UNC      0      353554      
Los Angeles      IRMSS002      MSS/UNC      0      553554      

UMA_Subs Table Data

I want to update the Cardtype in UMA_Subs where the Month = 0  and the M_Region = UMAPERF_MN.M_Region
withh the data from UMAPERF_MN.WSSCARDTYPE

K
0
 
LVL 8

Accepted Solution

by:
infolurk earned 250 total points
ID: 17055261
Usint Raynards query and your info;
UPDATE UMA_Subs INNER JOIN UMAPERF_MN ON UMA_Subs.M_Region = UMAPERF_MN.M_Region  SET UMA_SUBS.cardtype = UMAPERF_MN.WSSCARDTYPE
WHERE (((UMA_Subs.month)="0"));

Cheers
Steve
0
 

Author Comment

by:Karen Schaefer
ID: 17055265
Thanks thats great - you both can share the points.

Karen
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17055266
update
  UMA_Subs inner join UMAPERF_MN on UMA_Subs.M_Region = UMAPERF_MN.M_Region SET UMA_Subs.Cardtype = UMAPERF_MN.Cardtype Where UMAPERF_MN.Month = 0
0
 
LVL 8

Expert Comment

by:infolurk
ID: 17055318
Cheers.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

743 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

11 Experts available now in Live!

Get 1:1 Help Now