Oh wow I forgot to come back and answer this. I solved this problem by using a few group commands in MySQL. This was the final result:
PHP Code:
$expected_products_query = "select p.products_id, pd.products_name, products_date_available as date_expected, p.master_categories_id, CONCAT(MONTHNAME(STR_TO_DATE(MONTH(products_date_available), '%m')), ' ', YEAR(products_date_available)) as month_year
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = pd.products_id
and p.products_status = 1
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
zen_get_upcoming_date_range() . "
ORDER BY YEAR(date_expected) ASC, MONTH(date_expected) ASC, pd.products_name ASC";
Bookmarks