id | one | two
1 | aa |
2 | da |
3 | sds |
4 | as |
5 | dfss |
6 | r |
7 | fd |
如何将所有数据从“one”复制到“two”,其中长度为1 = = 2使用SQL?在这个例子中应该是:
id | one | two
1 | aa | aa
2 | da | da
3 | sds |
4 | as | as
5 | dfss |
6 | r |
7 | fd | fd
答案 0 :(得分:3)
UPDATE your_table SET two = one WHERE LENGTH(one) = 2
答案 1 :(得分:3)
这样的事情应该有用,我想:
UPDATE table SET two = one WHERE LENGTH(one) = 2