I have the following table in the database:
create table PERSON
(
PERSON_ID bigint auto_increment primary key,
BIRTHDAY date null,
GENDER varchar(255) null,
IDENTIFICATION varchar(15) null,
LAST_NAME varchar(50) not null,
NAME varchar(60) not null,
constraint UK_7vkwh3506i8iq0ijvqoewdciy unique (IDENTIFICATION)
);
And I want to do the following SQL statement in JPA2
SELECT
P.PERSON_ID,
P.BIRTHDAY
FROM PERSON P
WHERE
DATE_ADD(P.BIRTHDAY,
INTERVAL (YEAR(CURDATE()) - YEAR(P.BIRTHDAY))
+ IF(DAYOFYEAR(CURDATE()) > DAYOFYEAR(P.BIRTHDAY), 1, 0) YEAR)
BETWEEN
DATE_ADD(CURDATE(), INTERVAL 1 DAY)
AND
DATE_ADD(CURDATE(), INTERVAL 7 DAY);
I can't find the way of using date_add SQL method and nest between the other SQL methods.
I need some help please. :)