Search code examples
mysqlsqltop-n

SELECT 50 MAX FIRST PRICES without a "WHERE" clause


how to select the first maximum prices in a table without using the clause "where" ?


Solution

  • Your question is unclear.

    If you want 50 rows, even when there are duplicates, then you can use:

    select price
    from t
    order by price desc
    limit 50;
    

    If you want 50 distinct prices, then you can use:

    select distinct price
    from t
    order by price desc
    limit 50;