리자

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

· 2011-08-31 (수) 10:21:42 · 1538
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>
|
댓글을 작성하시려면 로그인이 필요합니다.

팁게시판

6,077건

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

+
제목 글쓴이 날짜 조회
11-09-01 조회 1,179
11-09-01 조회 1,060
11-09-01 조회 2,366
11-09-01 조회 1,977
11-09-01 조회 2,657
11-08-31 조회 618
11-08-31 조회 916
11-08-31 조회 1,193
11-08-31 조회 773
11-08-31 조회 758
11-08-31 조회 4,044
11-08-31 조회 1,539
11-08-30 조회 2,439
11-08-29 조회 1,356
11-08-29 조회 966
11-08-29 조회 3,453
11-08-28 조회 829
11-08-28 조회 1,951
11-08-28 조회 905
11-08-28 조회 1,305
11-08-27 조회 3,276
11-08-26 조회 839
11-08-26 조회 1,079
11-08-25 조회 907
11-08-25 조회 1,121