Question
Help with Oracle GROUP BY on dates
Just got connectivity to an Oracle DB/Server, and finding out
working with dates is VERY different. Been using CF7 for years,
writing T-SQL where possible on SQL Server and IBM UDB/DB2. Both,
along with almost every language I know, have a MONTH() and YEAR()
function. Apparently, Oracle does not. Have Google-searched tons of
Oracle date examples, but can't find anything that lets me group by
YEAR, MONTH.
I can use "to_char" and get results as OCT-08, SEP-08, etc. But I need to sort (ORDER BY) these. Since they are strings, query results are displayed alphabetically. With APR-08 and AUG-08 always shown first, since these months begin with letter "A".
Can anyone please provide a quick example of how to GROUP BY and ORDER BY a date field, but need it to display and sort GROUP-BY results by YEAR then MONTH? Would appreciate any help with the syntax, while I keep searching online for an example. Thanks.
Gary1
I can use "to_char" and get results as OCT-08, SEP-08, etc. But I need to sort (ORDER BY) these. Since they are strings, query results are displayed alphabetically. With APR-08 and AUG-08 always shown first, since these months begin with letter "A".
Can anyone please provide a quick example of how to GROUP BY and ORDER BY a date field, but need it to display and sort GROUP-BY results by YEAR then MONTH? Would appreciate any help with the syntax, while I keep searching online for an example. Thanks.
Gary1
