Finding upcoming birthdays with jOOQ

前端 未结 2 1239
萌比男神i
萌比男神i 2021-01-22 04:17

I\'m trying to convert an existing query which looks for upcoming birthdays to use jOOQ. My original query - using MySQL, and a bit simplified - is

SELECT COUNT(         


        
2条回答
  •  太阳男子
    2021-01-22 05:04

    One way of solving the issue is using a String in the where clause. I'm writing it down here for completeness, but I think it misses the point of jOOQ

    context.
        selectCount().
        from(PEOPLE).
        where("DATE_ADD(people_dob, INTERVAL YEAR(CURDATE()) - YEAR(people_dob) YEAR)" + 
            " BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()").
    

提交回复
热议问题