Having this selection:
id IDSLOT N_UM ------------------------ 1 1 6 2 6 2 3 2 1 4 4 1 5 5 1 6 8 1 7 3 1 8 7 1 9 9 1 10 10 0
I would like to get the row (only one) which has the minimun value of N_UM, in this case the row with id=10 (10 0).
If the cells are in a contiguous row or columnSelect a cell below or to the right of the numbers for which you want to find the smallest number. , click Min (calculates the smallest) or Max (calculates the largest), and then press ENTER.
To select data where a field has min value, you can use aggregate function min(). The syntax is as follows. SELECT *FROM yourTableName WHERE yourColumnName=(SELECT MIN(yourColumnName) FROM yourTableName);
Pandas DataFrame min() MethodThe min() method returns a Series with the minimum value of each column. By specifying the column axis ( axis='columns' ), the max() method searches column-wise and returns the minimum value for each row.
loc[] is used to select rows and columns by Names/Labels. iloc[] is used to select rows and columns by Integer Index/Position.
select * from TABLE_NAME order by COLUMN_NAME limit 1
I'd try this:
SELECT TOP 1 * FROM TABLE1 ORDER BY N_UM
(using SQL Server)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With