Skip to content

Instantly share code, notes, and snippets.

@pulading1988
Last active July 31, 2017 09:08
Show Gist options
  • Save pulading1988/6814c0f8db0bcd442715e849a946f4f0 to your computer and use it in GitHub Desktop.
Save pulading1988/6814c0f8db0bcd442715e849a946f4f0 to your computer and use it in GitHub Desktop.
查找substr在字符串str的第一个出现的位置
mysql> SELECT LOCATE('bar', 'foobarbar');
+---------------------------------------------------------+
| LOCATE('bar', 'foobarbar') |
+---------------------------------------------------------+
| 4 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
$specials = $specials->whereRaw("locate($display_area, display_area) > 0");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment