Select all rows that have at least a list of features

前端 未结 1 1268
悲哀的现实
悲哀的现实 2020-12-21 22:17

I have EXPERIMENTAL_RUNS (runId), each of which have any number of SENSORS (sensorId) associated with them. With that in mind, I have an RS table to join the two:

         


        
相关标签:
1条回答
  • 2020-12-21 22:58

    Assuming runId, sensorId are unique in the rs table, this will find the runIds that have all 3 sensorIds:

    SELECT runId, COUNT(c) ct
    FROM rs
    WHERE sensorId IN (11, 13, 15)
    GROUP BY runId
    HAVING ct = 3
    
    0 讨论(0)
提交回复
热议问题