0

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

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
Sara
  • 353
  • 1
  • 3
  • 13

4 Answers4

1

In mysql -

SELECT * FROM table_name
ORDER BY price desc LIMIT 50;
Nick
  • 138,499
  • 22
  • 57
  • 95
Khilesh Chauhan
  • 739
  • 1
  • 10
  • 36
1

this will work in mysql:

SELECT 
    select_list
FROM
    table_name
order by column_name
LIMIT 0 , 50;
Nikhil S
  • 3,786
  • 4
  • 18
  • 32
0
SELECT price
FROM table
ORDER BY price DESC
LIMIT 50;
Grega
  • 46
  • 3
0

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;
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786