Jump to content

substring query


sandy1028

Recommended Posts

From the MySQL manual:

 

SUBSTRING_INDEX(str,delim,count)

 

Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned. SUBSTRING_INDEX() performs a case-sensitive match when searching for delim.

 

So your query was nearly correct, try this:

 

SELECT id FROM `tablename` WHERE eid LIKE SUBSTRING_INDEX('2020/08/03/2163724v3d0324','/',-3)

Link to comment
https://forums.phpfreaks.com/topic/184743-substring-query/#findComment-977757
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.