Domanda

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?

È stato utile?

Soluzione

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)

Altri suggerimenti

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

Regards.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top