简体   繁体   English

压缩只有两列不同的表

[英]Compressing a table with distinct on only two columns

I have a table with no unique ID and two columns that need to be shortened and compressed down to unique values out of every third duplicate.我有一个没有唯一 ID 的表,有两列需要缩短并压缩为每三个重复项中的唯一值。 The table looks like this.桌子看起来像这样。 Every three records in mod_epoch and epoch_15 are the same, as I just need the distinct values. mod_epoch 和 epoch_15 中的每三个记录都相同,因为我只需要不同的值。 The date and epoch and travel_time_all_vehicles columns can be removed.可以删除日期和纪元以及 travel_time_all_vehicles 列。 I need the distinct travel_avg values so I can run 80th and 50th percentiles off of them per TMC.我需要不同的 travel_avg 值,以便我可以在每个 TMC 中运行它们的第 80 个和第 50 个百分位数。

tmc date    epoch   Travel_TIME_ALL_VEHICLES    mod_epoch   EPOCH_15    TRAVEL_avg
113N04415   1012016 184 209 64  21  200
113N04415   1012016 185 210 65  21  200
113N04415   1012016 183 181 63  21  200
113N04415   1012016 188 203 68  22  203
113N04415   1012016 186 209 66  22  203
113N04415   1012016 187 197 67  22  203
113N04415   1012016 191 205 71  23  213
113N04415   1012016 190 209 70  23  213
113N04415   1012016 189 227 69  23  213

So with this post it is hard to say what the author really needs;所以这篇文章很难说作者真正需要什么; in general, if you want to have some distinct values from a given table you can you DISTINCT t-sql keyword.一般来说,如果您想从给定的表中获得一些不同的值,您可以使用DISTINCT t-sql 关键字。

select distinct EPOCH_15, TRAVEL_avg
from [table]

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

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