Home > database >  The SQL query
The SQL query

Time:10-08

, how to pick up to a maximum number of a kind of minimum
Using SQL server statement

CodePudding user response:

Try the following

 
SELECT *
The FROM
(SELECT *, DENSE_RANK () OVER (PARTITION BY types of single number ORDER BY DESC, number) AS an RN FROM the TABLE) AS A
WHERE an RN=1

CodePudding user response:

I think the two
A, SELECT the order number, type, MIN (number) FROM the table name
WHERE type=(SELECT type FROM
WHERE numerical=(SELECT MAX (number) FROM the table name))
B, SELECT the order number, MAX (SELECT MIN (number) FROM the name of the table GROUP BY type) FROM the table name
Is wrong, the bosses know where is wrong
  • Related