일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- security
- StyleSheet
- input태그
- 시큐리티 로그인
- 시큐리티
- javascript
- 스프링 부트
- codingtest
- 코딩테스트
- JAVA11
- Spring boot
- 시큐리티 로그아웃
- 리눅스
- 반복문
- programmers
- sql
- java
- springboot
- 2차원배열
- Linux
- html
- 싱글톤
- springSecurity
- gradle
- 로그인
- 프로그래머스
- 목록
- 소스트리
- 시큐리티로그인
- css
Archives
- Today
- Total
JAVAIARY
mybatis INTERVAL 구문오류 해결 본문
select * from inq_board
where user_id = 'ID'
and
inq_date between (now() - interval '1year') and now()
order by inq_date desc, inq_id desc;
분명히 postgreSQL에서는 멀쩡히 잘 돌아갔던 구문
select * from inq_board
where user_id = ?
and
inq_date between (now() - interval ?) and now()
order by inq_date desc, inq_id desc;
하지만 mybatis 매퍼에 넣고 돌리면 구문오류라고 뜬다
머리가 너무 아팠는데 결국 연산이 안 되는 구문이었던 것
select * from inq_board
where user_id = ?
and
inq_date between (now() - CAST(? AS INTERVAL)) and now()
order by inq_date desc, inq_id desc;
String을 INTERVAL로 CASTING 해주는 방법 변경으로 해결
참고 :
https://stackoverflow.com/questions/13232633/how-to-pass-interval-in-mybatis-from-annotations
'selfEdu > 극약처방 ) Error' 카테고리의 다른 글
DBeaver DB 안 보일 때 (0) | 2023.02.20 |
---|---|
The Tomcat server configuration at \Servers\mvc-config is missing 오류 (0) | 2022.12.26 |
org.springframework.beans.factory.UnsatisfiedDependencyException 오류 (0) | 2022.12.19 |
the method {method} of type {class} must override a superclass method 오류 (0) | 2022.12.19 |
Logger cannot be resolved to a type 문제 (1) | 2022.12.15 |