简体   繁体   English

SQL Server 选择列中的所有最大和最小数据

[英]SQL Server select all max and min data in a column

+----+------+
| id | data |
+-----------+
| 1  |  a   |
| 2  |  b   |
| 3  |  a   |
| 3  |  c   |
+----+------+

I need to select data [a,b,c] .我需要选择数据[a,b,c]

Yes, got it.是的,明白了。 the query is 'SELECT distinct(data) from dataTable' Thanks.查询是 'SELECT distinct(data) from dataTable' 谢谢。

Do you want the distinct values in the second column?您想要第二列中的不同值吗?

select distinct data
from t;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM