MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » December 2013

Re: Simple use of substr problem



fixed

With stupiddate defined as a decimal 8.0 field:

With SQL:
with T1 as (
select substr(char(stupiddate),1,6) as yearmonth
from rob/htf)
select yearmonth, count(*) as nbrper
from t1
group by yearmonth
order by yearmonth

You could also do it this way in SQL:
select substr(char(stupiddate),1,6) as yearmonth,
count(*) as nbrper
from rob/htf
group by substr(char(stupiddate),1,6)
order by substr(char(stupiddate),1,6)

With Query/400
Define Result Fields
Field Expression
STUPIDCHAR digits(stupiddate)
YEARMONTH substr(stupidchar,1,6)
Select Sort Fields
Sort
Prty A/D Field Text
1 A YEARMONTH substr(stupidchar,1,6)
Select Report Summary Functions
---Options--- Field Text
5 YEARMONTH substr(stupidchar,1,6)
Define Report Breaks
Break Sort
Level Prty Field Text
1 10 YEARMONTH substr(stupidchar,1,6)




Rob Berendt





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact