我有一个无线电发射器检测列表,为了处理三角测量数据,我需要确保该站点有三个或更多接收器 ping 出来。
数据看起来像这样(除了在我的真实表中它是单个 DATETIME 字段):
Date Time Receiver Location Array Transmitter
4/30/2013 6:14:34 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:17:11 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:19:21 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:20:37 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:22:05 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:23:55 AM 119736 D/s L side 1 A69-1303-48591
4/30/2013 6:23:57 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:26:35 AM 119736 D/s L side 1 A69-1303-48591
4/30/2013 6:26:37 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:28:52 AM 119736 D/s L side 1 A69-1303-48591
4/30/2013 6:28:53 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:30:20 AM 119736 D/s L side 1 A69-1303-48591
4/30/2013 6:30:22 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:32:13 AM 119736 D/s L side 1 A69-1303-48591
4/30/2013 6:32:15 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:32:16 AM 119740 U/s R side 1 A69-1303-48591
4/30/2013 6:34:57 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:34:58 AM 119740 U/s R side 1 A69-1303-48591
4/30/2013 6:37:18 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:37:19 AM 119740 U/s R side 1 A69-1303-48591
4/30/2013 6:38:55 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:38:56 AM 119740 U/s R side 1 A69-1303-48591
4/30/2013 6:41:07 AM 119740 U/s R side 1 A69-1303-48591
4/30/2013 6:42:25 AM 119732 D/s R side 1 A69-1303-48591
4/30/2013 6:42:26 AM 119740 U/s R side 1 A69-1303-48591
4/30/2013 6:43:59 AM 119740 U/s R side 1 A69-1303-48591
4/30/2013 6:46:00 AM 119740 U/s R side 1 A69-1303-48591
4/30/2013 6:57:12 AM 113177 U/s Site 1 1 A69-1303-48591
如您所见,这条鱼(A69-1303-48591)在一小时内至少击中了三个接收器(119732、119736、119740、113177),因此我可以对它的动作进行三角测量。这是我编写代码的新手尝试:
SELECT * FROM detections WHERE
((
recID_Detection = '113177' OR recID_Detection = '119732' OR recID_Detection = '119736'
) AND
(recID_Detection = '119740'
))
OR
((
recID_Detection = '113177' OR recID_Detection = '119732' OR recID_Detection = '119740'
) AND
(recID_Detection = '119736'
))
OR
((
recID_Detection = '113177' OR recID_Detection = '119736' OR recID_Detection = '119740'
) AND
(recID_Detection = '119732'
))
OR
((
recID_Detection = '119732' OR recID_Detection = '119736' OR recID_Detection = '119740'
) AND
(recID_Detection = '113177'
))
GROUP BY transmitter
;
即使没有 GROUP BY 并且甚至没有时间限制(它应该),这段代码也会导致一个空集(它不应该),所以我确信我做了一些不正确的事情,但我不能在文献中找到与我想做的类似的事情。