sql - how to select characters after first 20 characters from field mysql -
sql - how to select characters after first 20 characters from field mysql -
select address (first 20 character) address1 , address (characters after first 20 if less 20 null) address2 client
how select string after 20 characters?
to characters after first 20 characters (note if there not 20 characters, function homecoming empty string):
select substring('some random address longer 20 characters' 20);
now if need address 2 null, check character length first:
select if(char_length(address) > 20, substring(address 20), null);
to first 20 characters, can utilize substring function this:
select substring('some random address', 1, 20);
now final query this:
select substring(address, 1, 20) address1, if(char_length(address) > 20, substring(address 20), null) address2 client
mysql sql phpmyadmin
Comments
Post a Comment