Maur�cio Albuquerque wrote:
> select * from tabela where DateTimeField < ValueDate + '23:59:59'

Of course, conceptually you mean DateTimeField '> $ZDTH(ValueDate,3).
That comparison would be much much easier and faster.

I'm not a big SQL user, so I'll answer with what I see wrong from a COS perspective.

DateTimeField < ValueDate + '23:59:59' should evaluate to either 23 or 24,
because DateTimeField < ValueDate is either 0 or 1, and that gets added to 23.
My guess is that it selected every row.
Is that true?

See <http://127.0.0.1:1972/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_arithmetic>.


'23:59:59' will still mess up if the timestamp time portion is '23:59:59.1'.
So in general, that's a bad approach.


You really want something fast like:
        SELECT * FROM tabela WHERE DateTimeField '> {fn CONVERT(ValueDate,SQL_DATE)}


[{fn CONVERT(ValueDate,SQL_DATE)} is loop invariant.]

Reply via email to