×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




You should look into using CAST() for the result of the CONCATs.

Or compare: Where (Year(PaymentDate) < Year(Current_Date) or
(Year(paymentDate) = Year(Current_Date) and month(PaymentDate) <
Month(Current_date)))

Paul

On 2017-10-10 10:36, dmmueller@xxxxxxx wrote:

With an RPG pgm, it's not a problem, that would all work, but I'm trying
to run a simple select SQL statement, it's not embedded sqlle.

What I thought would work..... doesn't :
select cust, money, year(paymentDATE) || month(paymentDATE) as "Payment
Month", year(current_date) || month(current_date) as "current YrMonth"
from library/file
where
year(paymentDATE) || month(paymentDATEi) < year(current_date) ||
month(current_date)

I'm finding the above is turning my dates into character and giving wrong
results.

Thanks all for the tips.

Diane

From: Paul Therrien <paultherrien@xxxxxxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Date: 10/10/2017 09:08 AM
Subject: Re: Date Comparison yyyymm

Create a start-month-date field yyyymm01 (load is with Current date and
replace the day number with '01')

If payment-date >= start-month-date then skip.

Paul

On 2017-10-10 09:58, Paul Nelson wrote:

How about the old reliable MOVEL op code into a 6 digit field?

Paul Nelson
Cell 708-670-6978
Office 409-267-4027
nelsonp@xxxxxxxxxxxxx

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
dmmueller@xxxxxxx
Sent: Tuesday, October 10, 2017 8:57 AM
To: MIDRANGE-L@xxxxxxxxxxxx
Subject: Date Comparison yyyymm

Group,
I have a date field "payment date" that I need to compare to current
date,

but only comparing the year & month.
Any payments received in the current month should be disregarded,

I know this is simple, and I'm over thinking it .

Diane Mueller

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list

To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link:

http://amzn.to/2dEadiD
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

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-2026 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.