472,139 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,139 software developers and data experts.

How move content fieldA to fieldB WHEN fieldC='X'

I tried:
UPDATE `tablename` SET `fieldA` = `fieldB`
WHERE fieldC = 'X';

in different combinations of fieldnames with/without _`_

I got: "Getroffen rijen: 0 (Query duurde 0.0011 sec)".

In normal language:
The group tablerows where fieldC has the value X
should have the content of fieldB in fieldA.

I found the technical term 'self-join' but
couldnt do much with it.\(Neither did I find examples that came close.

TIA4 any help ...

JanHolland
Dec 22 '06 #1
3 1099
ronverdonk
4,258 Expert 4TB
I ran the same update and it worked perfectly allright, as it should, with and without back-ticks!
Expand|Select|Wrap|Line Numbers
  1. UPDATE `tablename` SET `fieldA` = `fieldB` 
  2. WHERE fieldC = 'X';
  3.  
Maybe your fieldC does not contain a value 'X' or has a different data type.

Ronald :cool:
Dec 22 '06 #2
Another provider with a more modern MySQL
reported:
"MySQL answered:


#1054 - Unknown column 'X' in 'where clause'"
Dec 23 '06 #3
ronverdonk
4,258 Expert 4TB
Can't be that modern. How do you get an 'unknown column X' where you don't use a column X? You must use a different query then the one shown.

Ronald :cool:
Dec 23 '06 #4

Post your reply

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

Similar topics

reply views Thread by Helge | last post: by
1 post views Thread by Philip Wagenaar | last post: by
10 posts views Thread by Robert | last post: by
6 posts views Thread by fidodido | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.