답변 2개
select wr_name
, sum(if(instr(wr_4, '사과') >=0, 1, 0)) apple_count
, sum(if(instr(wr_4, '배') >=0, 1, 0)) peach_count
from g5_write_boardname and wr_is_comment=0
and wr_datetime between '2018-01-01 00:00:00' and '2018-01-07 23:59:59'
group by mb_id
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
select wr_4, (select count(a.wr_1)
from g5_write_table a
where a.wr_1 = '사과'
and a.wr_name = c.wr_name) cnt
,
(select count(a.wr_1)
from g5_write_table a
where a.wr_1 = '배'
and a.wr_name = c.wr_name) cnt
from g5_write_table c
where wr_4 <> ''
group by wr_4
답변에 대한 댓글 1개
답변 감사드립니다!!
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인