You really don't want to do it that way. You're doing a date conversion once for every post_date row in the table. Instead convert current_date - 1 days to the CCYYMMDD numeric format which would be only done once for the whole statement by the SQL optimizer. N row conversions to date is slower than one conversion to CCYYMMDD numeric.

Paul Morgan

Principal Programmer Analyst
IT Supply Chain/Replenishment


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Schutte, Michael D
Sent: Wednesday, August 31, 2011 8:06 AM
To: Midrange Systems Technical Discussion
Subject: RE: SQL question from an absolute SQL newbie

Instead of using iDate, use Date.

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


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Tom Hightower
Sent: Tuesday, August 30, 2011 7:34 PM
To: Midrange Systems Technical Discussion
Subject: SQL question from an absolute SQL newbie

Once again I come to the masters of all things SQL...

I have 2 files:

File TCKTHIST:
TICKET#
CUSTOMER#
TRAN_DATE (CCYYMMDD, likely not the same value as POST_DATE) POST_DATE (CCYYMMDD)


File NEWTCKTS:
TICKET#
CUSTOMER#
TRAN_DATE (CCYYMMDD)

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.





________________________________

Notice from Bob Evans Farms, Inc: This e-mail message, including any attachments, may contain confidential information that is intended only for the person or entity to which it is addressed. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and any attachments.

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.