With a date field I want to return a list of months that have any records. For example, if I only have records with dates of April, May, and December I just want to return April, May, and December.
Any ideas?
Just to be clear, I have records from several years, and when I select a year I want a list of months that had stories in them. If there weren't records in July then July shouldn't come back.
I guess I'm wondering if there is a select unique statement for this type of thing.
select distinct extract (month from dateColumn) from ogrish where extract(year from dateColulm) = 1925
That will return a month number. Standard SQL does not include any function for returnning month names. How that is done depends on your dbms.
Thanks!