Created
July 6, 2013 06:00
-
-
Save umidjons/5938829 to your computer and use it in GitHub Desktop.
Split string in MySQL with SUBSTRING_INDEX( str, delim, count )
Convert string to mysql date with STR_TO_DATE( str, format )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2); /* 'www.mysql' */ | |
SELECT SUBSTRING_INDEX('www.mysql.com', '.', -2); /* 'mysql.com' */ | |
/* split by 'ва' case-insensetively, and convert last date value to mysql date */ | |
SELECT STR_TO_DATE(SUBSTRING_INDEX(LOWER('30.11.2010 ва 01.11.2011'),'ва',-1),'%d.%m.%Y'); /* '2011-11-01' */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment