mysql中的聚簇表查询
我的 mysql 数据库中有一个表,其中有一列 score
和一列 cluster
。
score
是浮点数,cluster
可以是 NULL 或整数。
NULL 表示该行不属于任何簇,整数表示属于该簇。所以当然多行可以有相同的簇ID。
我想选择所有为 NULL 的行或集群中得分最高的行。
是否可以在选择或选择/联合星座或临时表中执行?最快的方法是什么?
I have a table in my mysql database which has a column score
and a column cluster
.
score
is float and cluster
may be NULL or integer.
NULL means the row belongs to no cluster, an integer means it does. so of course multiple rows can have the same cluster id.
I want to select all rows that are either NULL or the ones of a cluster that have the highest score.
Is it possible to do in a select or in a select/union constellation or with temperary tables? what is the fastest way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解你的问题,那么:
If I understood your question, then: