MYSQL
select max(count) as consulting_countMax, min(count) as consulting_countMin from
(select student_consulting_id, count(student_consulting_id) as count from consulting
where consulting_deletion="N" and consulting_date like concat(2021,'%')
group by student_consulting_id) as count
join student on student_id = student_consulting_id
where teacher_student_id = '49' and student_deletion="N";
MAPPER
<select id="getCompareConsulting" resultType="kr.portfolio.forfree.vo.StudentVO">
select max(count) as consulting_countMax, min(count) as consulting_countMin from
(select student_consulting_id, count(student_consulting_id) as count from consulting
where consulting_deletion="N" and consulting_date like concat(#{thisYear},"%")
group by student_consulting_id) as count
join student on student_id = student_consulting_id
where teacher_student_id = #{teacher_id} and student_deletion="N";
</select>
'괴발개발 > Spring Framework' 카테고리의 다른 글
에러: chart with id '0' must be destroyed, chart is reused (0) | 2021.10.06 |
---|---|
DB_top3, top5 와 같은 기능/효과, limit (0) | 2021.10.01 |
forfree메모 (0) | 2021.10.01 |
브라우저에 스크롤 만들기 (0) | 2021.10.01 |
DB_날짜형식 변환하기 (0) | 2021.09.30 |