var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Selecting "month/year" from table
I have a table in a mysql db with a date column. I would like to retrieve a list of distinct month/year values from the table.
Any ideas how to formulate the sql query? For example, I know I could use:
select distinct month(date_field) from table_name
but this doesn't take into account the year.
(I tried asking this on another and got no answer - my apologies to anyone who reads this twice)
try this TO_CHAR(Name_of_date_field, 'MM/YY') <--- this would take the 2 digits for month and year
Thanks, Lindsey. That did the trick. (though since I am using mysql, I had to substitute to_char with date_format)
It was really simple, but I couldn't get it on my on. The other forum I had asked on berated me a bit and I was quite frustrated.
Thanks again for your help.
you are welcome, and now i'm stuck with the tab-delimited hehe.. i'm supposed to write a query and the output should be tab-delimited format, but i don't know how to formulate the query