TimeStamp | USER ID | string_col |
---|---|---|
1 | 100001 | Here |
2 | 100001 | there |
3 | 100001 | Apple |
4 | 200002 | this is |
5 | 200002 | that is |
6 | 200002 | Apple |
7 | 200002 | some |
8 | 200002 | summer |
9 | 200002 | winter |
10 | 200002 | Apple |
这是我的原始表&;我想使用单词"Apple"作为触发词, for each 用户ID只连接上面的N行(在本例中是2行).
下表是我要查找的输出:
TimeStamp | USER ID | string_col | Result |
---|---|---|---|
1 | 100001 | Here | null |
2 | 100001 | there | null |
3 | 100001 | Apple | Here There |
4 | 200002 | this is | null |
5 | 200002 | that is | null |
6 | 200002 | Apple | this is that is |
7 | 200002 | some | null |
8 | 200002 | summer | null |
9 | 200002 | winter | null |
10 | 200002 | Apple | summer winter |