[긴급] SQL 구문 질문합니다. 채택완료
SQL 구문 관련 질문입니다,
현재 iframe으로 태그해온 링크에서 오류가 나서 급하게 도메인 주소만 바꾸려고 하는데,
영상 링크가 600~700이고. 일일히 수작업하기에는 시간이 너무 오래 걸려 SQL으로 패치를 하려고 합니다.
다만 제가 SQL을 잘 몰라서 질문드립니다.
이걸
로 변경해야 합니다.
29182077은 그대로 두고 [29182077은 임의의 값입니다. 게시글마다 값이 다 달라요.]
29182077 앞에 https://changeexample.com/?value=https://www.videochange.com/video" target="_blank" style="text-decoration-line: none; color: rgb(0, 136, 204); transition: border-color 0.4s, box-shadow 0.4s, background 0.4s, color 0.4s, opacity 0.4s;">https://changeexample.com/?value=https://www.videochange.com/video 를 붙이고, 29182077 뒤에 / 를 붙이고 싶은데 이런경우 SQL 구문을 어떻게 짜야되나요?
도움 주시면 감사하겠습니다.
답변 7개
조금 막연한 질문입니다.
컬럼명도 없고, 조건도 없는 상황이되겠지만.
컬럼을 임의로 col1 으로 칭하겠습니다.
</p><p>update table명</p><p>set col1 = concat(replace(col1, '<a href="<a href="https://example.com/player/player.php?tubeserver=youtube&id=29182077" target="_blank" rel="noopener noreferrer">https://example.com/player/player.php?tubeserver=youtube&id=29182077</a>" target="_blank" rel="noreferrer noopener" style="font-family: monospace; font-size: medium; white-space: pre-wrap; background-color: rgb(255, 255, 255); color: rgb(0, 136, 204);"><a href="https://example.com/player/player.php?tubeserver=youtube&id=" target="_blank" rel="noopener noreferrer">https://example.com/player/player.php?tubeserver=youtube&id=</a></a>',</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: "Apple SD 산돌고딕 Neo", "Apple SD Gothic Neo", 나눔고딕, "Nanum Gothic", 맑은고딕, "Malgun Gothic", 돋움, Dotum, Tahoma, Geneva, sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);">'<a href="<a href="https://changeexample.com/?value=https://www.videochange.com/video29182077/" target="_blank" rel="noopener noreferrer">https://changeexample.com/?value=https://www.videochange.com/video29182077/</a>" target="_blank" rel="noreferrer noopener" style="font-family: monospace; font-size: medium; white-space: pre-wrap; color: rgb(0, 136, 204);"><a href="https://changeexample.com/?value=https://www.videochange.com/video" target="_blank" rel="noopener noreferrer">https://changeexample.com/?value=https://www.videochange.com/video</a></a>'),'/')
</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: "Apple SD 산돌고딕 Neo", "Apple SD Gothic Neo", 나눔고딕, "Nanum Gothic", 맑은고딕, "Malgun Gothic", 돋움, Dotum, Tahoma, Geneva, sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);">where 조건</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: "Apple SD 산돌고딕 Neo", "Apple SD Gothic Neo", 나눔고딕, "Nanum Gothic", 맑은고딕, "Malgun Gothic", 돋움, Dotum, Tahoma, Geneva, sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);">
일렇게 처리하시면 해결될겁니다.
답변에 대한 댓글 4개
댓글을 작성하려면 로그인이 필요합니다.
많이 사용하는 DB 툴중에 phpMyAdmin 이 있습니다.
phpMyAdmin 설치 후, SQL 을 실행하면 됩니다. http://blog.embian.com/69">http://blog.embian.com/69
비슷한 툴로 php 파일 하나로 실행가능한 adminer 도 있습니다. https://www.adminer.org/">https://www.adminer.org/
댓글을 작성하려면 로그인이 필요합니다.
http://sqlfiddle.com/#!9/17891a/1">http://sqlfiddle.com/#!9/17891a/1
업데이트 쿼리문법 자체는 이상이 없습니다.
phpMyAdmin 의 경우 정상적인 문법임에도
자체적으로 어떠한 필터가 걸려있는지, 동작하지 않는 쿼리문이 가끔 있습니다.
답변에 대한 댓글 4개
- MySQL Workbench
- DBeaver
- Toad For MySQL
- phpMyAdmin
- client with command line
...
이것저것 해보고 하나가 안되면 그 하나가 문제입니다.
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
아래와 같이 에러가 뜹니다...
php 7.0 버전 ,mariadb 사용중입니다.. 왜이런걸까요...
테이블명하고 컬럼명 둘 다 있는 값인데 ㅠㅠ
댓글을 작성하려면 로그인이 필요합니다.
모든게시글을 변경하시려면
</p><p>
</p><pre>update <span style="color: rgb(51, 51, 51); font-family: Arial, 돋움, Dotum; font-size: 13px; white-space: normal; background-color: rgb(247, 247, 247);">g5_write_video </span></pre><pre>set <span style="color: rgb(51, 51, 51); font-family: Arial, 돋움, Dotum; font-size: 13px; white-space: normal; background-color: rgb(247, 247, 247);">wr_content </span>= concat(replace(<span style="color: rgb(51, 51, 51); font-family: Arial, 돋움, Dotum; font-size: 13px; white-space: normal; background-color: rgb(247, 247, 247);">wr_content </span>, '<a href="https://example.com/player/player.php?tubeserver=youtube&id='," target="_blank" rel="noopener noreferrer">https://example.com/player/player.php?tubeserver=youtube&id=',</a>
'<a href="https://changeexample.com/?value=https://www.videochange.com/video'),'/')" target="_blank" rel="noopener noreferrer">https://changeexample.com/?value=https://www.videochange.com/video'),'/')</a>
where 1=1</pre><pre>
으로 변경해보세요
답변에 대한 댓글 2개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인