sql - how to select characters after first 20 characters from field mysql -
address 1, address as address (first 20 characters) from customer as address 2
How do I select a string after 20 characters? To get the letters after the first 20 characters (note that if there are no twenty letters, the function will return an empty string):
SELECT SUBSTRING ('some random address that is 20 characters Is too long '20);
Now if you have to know 2 to be taped, then first check the character:
if you select (char_length (address)> 20, SUBSTRING (address, 20 to 20); To get 20 characters from the first letter, you can use such substring functions: SELECT SUBSTRING ('some random address' 1, 20);
Now the last query may look like this:
SELECT SUBSTRING (address, 1, 20) address 1, IF ( 20 as address 2, SUBSTRING (20 addresses, NULL) from CHAR_LENGTH (Address) & gt;
Comments
Post a Comment