문제

I am trying to query documentum server using DQL query. Using DATEDIFF function to select data that are created in the current date. Here is the query

    SELECT title FROM content_table WHERE DATEDIFF(day, "r_creation_date", DATE(TODAY)) < '1' AND content_type IN ('story','news')

Problem is along with today's data its selecting yesterday's also. Why is less than 1 condition fetching yesterday's data also?

Have tried using DATEDIFF(day, "r_creation_date", DATE(TODAY)) = '0' but that does not fetch any result. I understand even the time comes into picture but as I am using 'day' as the date pattern will it not just calculate difference of the days alone?

도움이 되었습니까?

해결책

You can try this query:

SELECT title FROM content_table WHERE r_creation_date > DATE(TODAY) AND content_type IN ('story','news')

if you need the objects created today (after 00:00, not in the last 24 h)

다른 팁

I should use the GETDATE() function to get the current day

Regards.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top