리자

MySQL 성능 최적화 중 INNER JOIN ... USING 메모

· 14년 전 · 1440
create table daily_hit_counter ( day date not null, slot tinyint unsigned not null, cnt int unsigned not null, primary key (day, slot) );


update daily_hit_counter as c inner join ( select day, sum(cnt) as cnt , min(slot) as mslot from daily_hit_counter group by day) as x using(day) set c.cnt = if(c.slot = x.mslot, x.cnt, 0), c.slot = if (c.slot = x.mslot, 0, c.slot);<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:27:00 MySQL에서 이동 됨]</div>
|
댓글을 작성하시려면 로그인이 필요합니다.

팁게시판

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
14년 전 조회 952
14년 전 조회 1,081
14년 전 조회 957
14년 전 조회 2,239
14년 전 조회 1,868
14년 전 조회 2,542
14년 전 조회 509
14년 전 조회 799
14년 전 조회 1,073
14년 전 조회 669
14년 전 조회 645
14년 전 조회 3,933
14년 전 조회 1,441
14년 전 조회 2,340
14년 전 조회 1,251
14년 전 조회 850
14년 전 조회 3,352
14년 전 조회 726
14년 전 조회 1,845
14년 전 조회 774
14년 전 조회 1,191
14년 전 조회 3,176
14년 전 조회 725
14년 전 조회 975
14년 전 조회 787