我不知道如何很好地解释这一点,所以请忍受我.
我试图对彼此相邻的相似行进行分组,如果相同,则基本上忽略第n个行.我不确定这在MySQL中是否容易实现.这些行除了描述外没有其他属性.如果还有其他不重复的“描述”,我仍然希望将它们返回.
我有一张桌子,上面满是这样的条目:
+--+-------------------------+
|id|description |
+--+-------------------------+
| 1|hello |
+--+-------------------------+
| 2|foobar | \_ Condense these into one row
+--+-------------------------+ /
| 3|foobar |
+--+-------------------------+
| 4|hello |
+--+-------------------------+
| 5|world | \__ Condense these into a row
+--+-------------------------+ /
| 6|world |
+--+-------------------------+
| 7|puppies |
+--+-------------------------+
| 8|kittens | \__ These too...
+--+-------------------------+ /
| 9|kittens |
+--+-------------------------+
|10|sloths |
+--+-------------------------+
|11|kittens |
+--+-------------------------+