1

I would like to remove the first part of the string and the comma that seperates the string.

Current code that produces data:

SELECT PrizeMoneyBreakDown from race2;
SELECT
   SUBSTRING_INDEX((SUBSTRING_INDEX(PrizeMoneyBreakDown,';',1)),';',-1) AS 1st,
FROM race2

Data:

1st,4000    
1st,4550
1st,4550    
1st,4550    
1st,4550

Desired output:

4000
4550
4550
4550
4550
Shadow
  • 33,525
  • 10
  • 51
  • 64
kjdcwckj
  • 33
  • 3

1 Answers1

0

The following query will take the 5-th character of the string till the end :

SELECT
   SUBSTRING(PrizeMoneyBreakDown,5,length(PrizeMoneyBreakDown)) as st1
FROM race2

Demo

Or using your method, change the ; with ; and 1 to -1 to take the second part of the string

SELECT
   SUBSTRING_INDEX((SUBSTRING_INDEX(PrizeMoneyBreakDown,',',-1)),',',1) AS 1st
FROM race2
Ergest Basha
  • 7,870
  • 4
  • 8
  • 28