SELECT SUBSTRING(FieldName,0,20) FROM Table
I try on phpmyadmin and returned empty value. How i use this function ?
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()
you must use SELECT SUBSTRING(FieldName,1,20) FROM Table
, because from 0 is 0 :)
use 1
ups, someone wrote answer faster than I :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With