i would like to be able to do a select query, taking only the distinct first words of the string, excluding the last one. If not clear, here is the result i\'d like to have
SELECT DISTINCT TRIM(SUBSTRING(model, 1, LENGTH(TRIM(model))-4))
You can reverse the string to find the first space " "
" "
SQL Demo
SELECT DISTINCT RTRIM(REVERSE(SUBSTRING(REVERSE(`model`),LOCATE(" ",REVERSE(`model`))))) FROM Table1
OUTPUT