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



You probably should do it right in the group by. I just prefer the cte because it appears cleaner.

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Michael Ryan
Sent: Friday, September 16, 2011 2:24 PM
To: Midrange Systems Technical Discussion
Subject: Re: Showcase Date Handling

Michael...would I need a CTE? I could probably do the substringing
right in the GROUP BY (and a SELECT up higher), right?

On Fri, Sep 16, 2011 at 2:08 PM, Schutte, Michael D
<Michael_Schutte@xxxxxxxxxxxx> wrote:
Not sure what showcase is. But in sql you could do


With cte as (
Select a.*,
Case when dec(substring(digits(mydate), 5, 2),2,0) >= 10 then dec(substring(digits(mydate), 1, 4), 4, 0) + 1
    Else dec(substring(digits(mydate), 1, 4), 4, 0)
END as MYYEAR
FROM MYFILE A
)
Select MYYEAR, ... from cte group by MYYEAR


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Michael Ryan
Sent: Friday, September 16, 2011 1:43 PM
To: Midrange Systems Technical Discussion
Subject: Showcase Date Handling

Anyone know how I would do this from Showcase:

GROUP BY
       CASE
       WHEN MONTH ( DATE ( MYDATE, YYYYMMDD ) ) >= 10 THEN YEAR ( DATE (
MYDATE, YYYYMMDD ) ) + 1
       ELSE YEAR ( DATE ( MYDATE, YYYYMMDD ) )
END

in standard SQL? MYDATE is an 8.0 numeric field containing a date like 20110916.

Thanks!
--
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: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

________________________________

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.
--
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: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.