728x90 반응형 MySQL10 [MySQL] 문자 치환하기 REPLACE() REPLACE(field, '수정 전', '수정 후'); ex)update 테이블 set 컬럼=replace(컬럼 ,'수정 전','수정 후');update coordi_type_table set coordi_type=replace(coordi_type, 'a' , 'b' ); coordi_type_table coordi_type (치환 전) coordi_type(치환 후) a b 2015. 6. 30. 몇 년치 날짜데이터 테이블 만들기 1. 날짜테이블을 생성하기 위한 더미 테이블 생성 create table t (n int); insert into t values (1); // 입력할 년도의 날짜 수만큼 행을 생성한다. insert into t select * from t 2. 날짜테이블 생성 create table date_t (d date, ds char(8)); insert into date_tselect d, date_format(d, '%Y%m%d') from ( select @rnum:=@rnum+1 as rownum, date(adddate('2014-01-01', interval @rnum day)) as d from (select @rnum:=-1) r, t ) twhere year(d) < 2024; [출처] http.. 2015. 6. 30. 이전 1 2 3 다음 728x90 반응형