본문으로 바로가기

변수 사용 예

category [ 서버 & DB 관련 ]/MySQL 2019. 5. 2. 12:17

DELIMITER //
declare tmpdate varchar(10)
set @tmpdate = '2019-02-07';
SELECT right(SUBSTRING_INDEX(content, '</forem_date>', 1), 10), right(SUBSTRING_INDEX(content, '</through_date>', 1), 10), content from 테이블 where form_id = 1 and right(SUBSTRING_INDEX(content, '</forem_date>', 1), 10) >= @tmpdate and right(SUBSTRING_INDEX(content, '</through_date>', 1), 10) <= @tmpdate;
//

DELIMITER ;