막 Mysql을 공부하기 시작한 학생입니다. 여기저기 돌아다니면서 방법을 찾고 있는데 쉽지가 않네요.. 그래서 이렇게 염치불구하고 질문드립니다.
현재 가지고 있는 DB의 구성은 다음과 같이 되어 있습니다.
ID NUMBER
----- ----------------
1 a(1), c(2), d(2)
2 b(2), d(1)
3 a(3), b(2), c(1), d(2)
즉 Number라는 열에 각각의 data들이 괄호 또는 ","로 구분되어 있는데 이를 분리하려고 합니다.
즉, Number열에 있는 각각의 문자와 숫자를 구분해서 새로운 열로 바꾸려고 합니다. 즉,
ID #1 #2 #3 #4 #5 #6 #7 #8
----- ------ ----- ----- ----- ----- ----- ----- -----
1 a 1 c 2 d 2
2 b 2 d 1
3 a 3 b 2 c 1 d 2
이런식으로 각각의 data를 열로 구분한 후 다시 이를 행으로 바꾸려고 합니다. 즉,
ID ID#1 ID#2
----- ----- -----
1 a 1
1 c 2
1 d 2
2 b 2
2 d 1
이와 같이 행과 열을 바꾸어서 DB에 저장하려고 하는데, 여기저기 찾아봐도 도저히 모르겠네요.. 고수님들의 답변 부탁드립니다.
정말정말 감사합니다.
|