The SUBSTR
start index is 1
in mysql. So, you should change your code to:
SELECT SUBSTR(FieldName,1,20) FROM TABLE;
Notice that SUBSTR()
is a synonym for SUBSTRING()
so they can be used interchangeably.
You should also checkout the documentation for SUBSTRING()