集計関数MIN
を使用します :
SELECT MIN(date_added) AS OldestDate
FROM products_to_categories
WHERE products_id = 2085;
各製品の最も古い日付を探している場合は、GROUP BY
を追加します :
SELECT products_id, MIN(date_added) AS OldestDate
FROM products_to_categories
GROUP BY products_id;