1

我有这个 :

   ID      ROW_A    ROW_B

'62919' | '9430' | '40754'

多亏了这个查询,我明白了:

SELECT * FROM myTable 
WHERE ROW_A != 0

我想更新它,将 ROW_A 的值放入 ROW_B

那么,是否可以通过一个查询进行以下处理?

现在,我正在使用这个(但它是错误的):

UPDATE myTable SET ROW_B = ROW_A
WHERE ID IN(
SELECT * FROM myTable
WHERE ROW_A != 0)
4

3 回答 3

5

我认为不需要子查询:

UPDATE  myTable 
SET     ROW_B = ROW_A
WHERE   ROW_A != 0
于 2013-01-14T14:56:38.240 回答
2
UPDATE myTable 
SET ROW_B = ROW_A
WHERE ROW_A != 0
于 2013-01-14T14:58:23.860 回答
0

这可能有效:

UPDATE myTable SET ROW_B = A
WHERE ID IN(
SELECT ROW_A as A FROM myTable
WHERE ROW_A !=0)
于 2013-01-14T15:03:06.850 回答