$query = 'SELECT c.*, g.id_file, g.name as file_name FROM #__catalogue as c JOIN #__catalogue_gallery as g ON c.id=g.id_offer WHERE '.$where.' AND (g.is_main != 1 AND g.is_logo != 1) AND c.published = 1 GROUP BY g.id_offer ORDER BY c.id DESC';
pobiera ono rekordy z tabeli catalogue i dodaje zdjecie z galerii. teraz chcialbym wyciagac tylko najnowsze zdjecie a nie mam juz pomyslu jak to rozwiazac

czyli g.id_file DESC