I figured it out
function do_post_dates(){
global $wpdb;
$rows = $wpdb->get_results("SELECT concat(year(post_date),'-', month(post_date)) as post_y from {$wpdb->prefix}posts group by year(post_date), month(post_date)");
$post_dates = $rows;
return $post_dates;
}