2009-10-09 2 views
0

내 표는 다음과 같습니다업데이트 여러 행

c1 c2 c3 
a 1 2000 
a 2 2001 
a 3 3000 
a 4 3001 
a 5 3002 

1 단계 : 변화 3000 2000, 3001에에 : 어디 C3 = 2000, 2001

Delete table where c3 like '2___' 

2 단계 행을 삭제 2001, 3002 to 2002 등

여기에 붙어 있습니다. 나는 모든 포인터 또는 예제를 감사하겠습니다.

답변

2
  1. DELETE tablename WHERE c3 in (2000, 2001)

    DELETE tablename WHERE c3 LIKE '2%'

  2. UPDATE tablename SET c3 = c3 - 1000

0

시도 :

DELETE yourtable where c3 in (2000,2001) 

UPDATE yourtable 
    set C3=C3-1000 
    WHERE c3>=3000 AND c3<4000 
4

당신의 가정 C3 컬럼이 문자열 (당신이 말을하지 않습니다) :

delete MyTable where c3 between 2000 and 2999 
update MyTable set c3 = c3 - 1000 where c3 between 3000 and 3999 
:
delete MyTable where c3 like '2%' 
update MyTable set c3 = '2' + substring(c3, 2, len(c3) - 1) where c3 like '3%' 

이 C3 열을 가정하면 정수