我已经尝试了好几天了,但是我仍然找不到如何实现这一点,也没有找到一些想法。
例如,我有这样一个表:
+------+------------------+--------+
|NAME |WHEN |LOCATION|
+------+------------------+--------+
|TOM |17/05/20 00:00:00 |ABC |
+------+------------------+--------+
|BOB |17/05/20 00:00:00 |ABC |
+------+------------------+--------+
|BOB |17/05/20 00:00:00 |XYZ |
+------+------------------+--------+
|BOB |18/05/20 00:00:00 |TRD |
+------+------------------+--------+
|SAM |19/05/20 00:00:00 |ABC |
+------+------------------+--------+
|TOM |18/05/20 00:00:00 |ABC |
+------+------------------+--------+
|TOM |21/05/20 00:00:00 |ABC |
+------+------------------+--------+
|SAM |23/05/20 00:00:00 |XYZ |
+------+------------------+--------+
|BOB |20/05/20 00:00:00 |XYZ |
+------+------------------+--------+
我想选择在1周(或任何给定时间段)内去过2个以上“地点”的任何“名称”。从表中可以看出,由于tom只去过一个位置,因此不应拾取他,输出应如下所示:
+------+------------------+--------+
|NAME |WHEN |LOCATION|
+------+------------------+--------+
|BOB |17/05/20 00:00:00 |ABC |
+------+------------------+--------+
|BOB |17/05/20 00:00:00 |XYZ |
+------+------------------+--------+
|BOB |18/05/20 00:00:00 |TRD |
+------+------------------+--------+
|SAM |19/05/20 00:00:00 |ABC |
+------+------------------+--------+
|SAM |23/05/20 00:00:00 |XYZ |
+------+------------------+--------+
|BOB |20/05/20 00:00:00 |XYZ |
+------+------------------+--------+
2条答案
按热度按时间deikduxw1#
用下列方法尝试
count
. 这是演示。输出:
sd2nnvve2#
尝试下面的代码,它将帮助你
输出