Saturday, June 12, 2010

Oralce SQL:
Select the maximum date from each month in a date column .
column named (date_col) contains dates and you would like to select the maximum date from each month in this column.

select max(date_col)
from table_name
group by to_char(date_col,'mm'),to_char(date_col,'yyyy')

No comments:

Post a Comment