假设我们有桌子 PEOPLE
id | name | extracted
-----------------------------------------
1 | Roger |
-----------------------------------------
2 | Anthony |
-----------------------------------------
3 | Maria |
-----------------------------------------
我们用
SELECT SUBSTRING(name, 1, 3) FROM people.name WHERE name like '%thon%'
它会找到“Anthony”并提取 3 个第一个字符 - 所以结果是:Ant
如何将此结果与相同的 id 放在一起,使表格看起来像
id | name | extracted
-----------------------------------------
1 | Roger |
-----------------------------------------
2 | Anthony | Ant
-----------------------------------------
3 | Maria |
-----------------------------------------