mysql - select substring of column returns null and empty -
i'm having trouble using mysql's substr function.
my query is:
select distinct(substr(col1,0,10)) table;
the results returned null , empty row.
am using substr incorrectly, or can not use distinct or column name?
thanks
firstly, position of first character of string 1, not 0; should fix it:
select distinct(substr(col1, 1, 10)) `table` secondly, table contains @ least 1 row in col1 null. rows, result of substr null well.
Comments
Post a Comment