반응형
250x250
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- kubeflow
- codedeploy error
- 도커
- JavaScript
- AWS CI/CD 구축하기
- Flux
- aws cicd
- chart.js
- openlens
- Spring
- aws
- java bigdecimal
- Airflow
- IntelliJ
- codedeploy
- Kafka
- codebuild
- SQL
- Spring Error
- codepipeline
- bootstrap
- Python
- node
- chartjs
- PostgreSQL
- redis
- COALESCE
- docker
- VPN
- Jenkins
Archives
- Today
- Total
Small Asteroid Blog
[mysql] cannot check if timestamp is between varchar(23) and varchar(23) - 날짜 조회 쿼리 본문
백엔드/DB
[mysql] cannot check if timestamp is between varchar(23) and varchar(23) - 날짜 조회 쿼리
작은소행성☄️ 2021. 9. 28. 13:34728x90
sql에서 timestamp 형식의 날짜에서 날짜와 날짜 사이의 데이터를 조회하고자 한다.
date 컬럼의 날짜의 형식은 timestamp 이며, 조회하고자 하는 날짜는 문자열로 조회하려고 했다.
기존쿼리문
select *
from table1
where date between '2021-09-28 12:00:00.000' and '2021-09-28 18:00:00.000'
문자열로 표시한 날짜 앞에 timestamp 를 붙여서 사용하면 조회가 가능하다.
select *
from table1
where date between timestamp '2021-09-28 12:00:00.000' and timestamp '2021-09-28 18:00:00.000'
728x90
반응형
'백엔드 > DB' 카테고리의 다른 글
| postgresql 테이블 데이터 모두 삭제 (truncate) (0) | 2021.11.15 |
|---|---|
| postgresql 테이블 lock 조회 및 lock 해제 (0) | 2021.11.11 |
| select limit ? offset ? (페이징 활용) (0) | 2021.09.23 |
| [SQL] COALESCE , LEAD, LAG 함수 (NULL이 아닌 첫번째 값, 이전값, 다음값) (0) | 2021.07.30 |
| [sql] case - when - then - else - end (0) | 2021.07.30 |