By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,399 Members | 960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,399 IT Pros & Developers. It's quick & easy.

Simple Query

P: 24
I am trying to update a column in one of the Table based on a column in other table and it doesn't do anything.

Table1
Columns: A, B, C

Table2
Columns: A, D, E

The column E in Table2 is empty and I want to update it with C from Table1
where Table1.A = Table2.A

Here is my query.

UPDATE Table2 INNER JOIN Table1 ON Table2.A = Table1.A
SET Table2.E = Table1.C;

But it doesn't update anything. Can some one tell me where I am doing wrong.

THnaks.
Nov 21 '06 #1
Share this Question
Share on Google+
3 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Run this query, what are the results

Expand|Select|Wrap|Line Numbers
  1.  SELECT Table2.*, Table1.* 
  2. FROM Table2 INNER JOIN Table1 ON Table2.A = Table1.A ;
  3.  
Nov 21 '06 #2

P: 24
ymk
Run this query, what are the results

Expand|Select|Wrap|Line Numbers
  1.  SELECT Table2.*, Table1.* 
  2. FROM Table2 INNER JOIN Table1 ON Table2.A = Table1.A ;
  3.  
---------------------------------


It ran but it didn't give me any results. 0 rows.
Nov 21 '06 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
---------------------------------


It ran but it didn't give me any results. 0 rows.
Sorry I had to go out for a few hours

There is a problem with the data relationship between Table1.A and Table2.A

Is A the same datatype in both tables and what is that datatype

e.g. are they both numbers, text ?

Are you sure that there is values in Table1 in A that correspond to Table2 A
Nov 21 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.