× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 31-Aug-2011 05:06 , Schutte, Michael D wrote:
Someone previously responded:
Where iDate(post_date,...) = current_date - 1 days


Instead of using iDate, use Date.

Where
Date(digits(post_date) concat '000000') = current_date - 1 days

Tom Hightower on Tuesday, August 30, 2011 7:34 PM wrote:

<<SNIP>>

I need to work up an SQL statement that will find all entries in
TCKTHIST with a post_date = yesterday and which are not in file
NEWTCKTS. Fields TICKET#, CUSTOMER# and TRAN_DATE are common
fields to both files; POST_DATE is only in TCKTHIST.



I would even avoid DATE() in this case; instead using CHAR().

The given predicate on the WHERE clause, even with the change from iDate() to DATE() to remove the UDF, does not allow for an implementation which can utilize the typical [non-derived binary radix] index on POST_DATE. A matching derived index would need to be created to enable that; e.g.:

create index ...
( Date(digits(post_date) concat '000000') )

I would prefer instead to leave the field name as the 'expression' on the left of the equal sign and then cast the type in the expression on the right to match that of the column, in order to enable an [existing non-derived] index to be used to implement the query:

where
post_date = dec(replace(char(current_date-1 day,iso),'-',''), 8)

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.