469,934 Members | 2,575 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

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 ...

Dec 22 '06 #1
3 1063
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';
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
"MySQL answered:

#1054 - Unknown column 'X' in 'where clause'"
Dec 23 '06 #3
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
By using this site, you agree to our Privacy Policy and Terms of Use.