I m trying to retreive data from a table and the date field in the table are defined as charter. so i figure if i can extract just the month and year portion of current_date and converted to character, everything should work...but i m getting errors after error.
this is the query:
SELECT orgn_state as ORIGIN
, dest_state as DESTIN
, 'PRIVATE' as "TYPE"
,'CONT' as EQUIP
, '48' as SIZE
, '2003' as "YEAR"
, acct_mm as "MONTH"
, sum(carloads) as VOLUME
from tablename
Where acct_yr = substr(convert_char(year(current_date -1 month)), 2,2)
and acct_mm = convert_char(month(current_date - 1 month))
**Note:
acct_yr and acct_mm are of type CF with X(2) format
this is the query:
SELECT orgn_state as ORIGIN
, dest_state as DESTIN
, 'PRIVATE' as "TYPE"
,'CONT' as EQUIP
, '48' as SIZE
, '2003' as "YEAR"
, acct_mm as "MONTH"
, sum(carloads) as VOLUME
from tablename
Where acct_yr = substr(convert_char(year(current_date -1 month)), 2,2)
and acct_mm = convert_char(month(current_date - 1 month))
**Note:
acct_yr and acct_mm are of type CF with X(2) format