假设我有一桌人,一桌水果和一桌喜欢。
People fruit likes
+-----+--------+ +-----+---------+ +-----+-----+
| pid | people | | fid | name | | pid | fid |
+-----+--------+ +-----+---------+ +-----+-----+
| 1 | Mary | | 1 | appple | | 1 | 1 |
| 2 | Tom | | 2 | orange | | 2 | 1 |
| 3 | John | | 3 | banana | | 2 | 2 |
| 4 | George | | 4 | coconut | | 2 | 3 |
...
我想做一个查询,可以搜索喜欢苹果和橙子的人:
Result
+----------+---------------
| People | likes
+----------+---------------
| Tom | apple, orange, banana
其实我也想知道how to make the same output above but with different conditions
说喜欢橘子不喜欢苹果的人,或者不喜欢香蕉的人等等。