可能有一个简单的解决方案。但是我的问题是如何在以下查询中选择 100 或 1000 个不同的 avclassfamily 值?
理想情况下,会有一个类似于“select distinct ON (1000) (avclassfamily)”的命令,但没有。
cursor.execute("select count(*),date_trunc( 'year', first_seen ) from (select DISTINCT ON (avclassfamily) * from malwarehashesandstrings) as p where first_seen is not null and behaviouralbinary is true and origindataset != 'MalRec' and origindataset != 'Ember Benign' and origindataset is not null group by date_trunc( 'year', first_seen );")
如果您有解决方案或有什么我可以澄清的,请告诉我
编辑:根据要求,查询的更简单版本:
select DISTINCT (avclassfamily) from malwarehashesandstrings;
但是说是否可以在那里选择 100 个不同的值