在SQL中,如何获取列的值在表中最低的所有行? [英] In SQL, how do I get all rows where a column's value is the lowest in the table?
本文介绍了在SQL中,如何获取列的值在表中最低的所有行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是SQL的新手,我使用这个查询来查找我的表的字段的最小值。
I am a newbie to SQL, I am using this query to look for the minimum value in the field weight of my table.
SELECT product_id,
MIN(weight)
FROM table
WHERE 1;
它显示一个字段的最小值,但只有一个?但我有很多相同最小重量的产品。是否有一种方法可以指定我需要显示所有其他产品?
It does show one field with the min value, but only one? But I have many products with the same minimum weight. Is there a way I could specify that I need to show all other products?
推荐答案
select * from table where weight = (select MIN(weight) from table)
这篇关于在SQL中,如何获取列的值在表中最低的所有行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文