Mysql – How to get different “modules” from modules table

MySQL

I have "moduller" table in that table keeping modules of system with function name. Two information in one field. Like this:

enter image description here

Slug field mean is like this: "MODULE_NAME/function_name"

I want to get the list:
1. admin
2. ajax
3. analysisusers
4. bonus

How to get i'm only different modules names like above?

Best Answer

Find the position of the / character, take everything left of it, then do DISTINCT

SELECT DISTINCT LEFT(slug,LOCATE('/',slug) - 1) module_name
FROM moduller WHERE LOCATE('/',slug) > 0;