select * from materialRestriction where dealercode='1679' and materialcode='1000008'
위의 SELECT문을 실행시키면 startDay란 컬럼과 endDay란 컬럼이 나오는데요
각각 20230802와 20230805란 값이 나옵니다..
근데 이값을
select * from materialRestriction
where dealercode='1679'
and materialcode='1000008'
and ((startDay between '20230803' and '20230804')
or endDay between '20230803' and '20230804'))
이 위의 같이 3일이나 4일로 조건을 잡아서 select문을 날리면 20230802와 20230805란 값이 조회가 될 수 있는 조건값이 있을까요??
검색기간의 시작일과 종료일을 서로 교차하여 비교
AND 시작일 <= :검색종료일
AND 종료일 >= :검색시작일
SELECT * FROM materialRestriction WHERE dealercode = '1679' AND materialcode = '1000008' AND startDay <= '20230804' AND endDay >= '20230803' ; -- http://gurubee.net/article/45391
감사합니다 마농님!