I have the following request
SELECT Count(*) as Total_Count, Col1 FROM Table1 GROUP BY Col1 ORDER BY Total_Count DESC;
I want to zoom in on Col1. Data in Col1 has the following format:
text-abc1 txt4-abcde22 tex6-abc2 text4-imp4 text-efg1 txt-efg43
I want to be able to group it
After the first `-`, any first three/four/five characters match
In this example, if we match the first 3 characters. The output will be:
Total_Count Col1 3 abc 1 imp 2 efg
Any other way to achieve this?
database regex mysql group-by
theking963
source share