我必须翻译
AND <timestamp> BETWEEN (now()::date - interval '1 day' * (EXTRACT(DOW FROM now()::date) - 1) - interval '{{number_of_periods}} {{time_interval}}') AND (now()::date - interval '1 day' * (EXTRACT(DOW FROM now()::date) - 1))
从SQL到HQL - 我该如何实现?
谢谢!
答案 0 :(得分:0)
答案:
AND CAST(<timestamp> AS TIMESTAMP) BETWEEN CAST(now() AS DATE) - INTERVAL '1' DAY * (EXTRACT(DOW FROM CAST(now() AS DATE)) - 1) - INTERVAL '{{number_of_periods}}' DAY * 7 AND (now() - INTERVAL '1' DAY * (EXTRACT(DOW FROM CAST(now() AS DATE)) - 1))