Mysql SQL有没有办法选择作为给定值开头的所有值?
我正在尝试从数据库中选择作为给定值开头的所有内容。我的意思是:Mysql SQL有没有办法选择作为给定值开头的所有值?,mysql,sql,Mysql,Sql,我正在尝试从数据库中选择作为给定值开头的所有内容。我的意思是: +--------------+-----------------------+ | ID | url | +--------------+-----------------------+ | 1 | https://example.net | +--------------+-----------------------+ | 2
+--------------+-----------------------+
| ID | url |
+--------------+-----------------------+
| 1 | https://example.net |
+--------------+-----------------------+
| 2 | https://example.com |
+--------------+-----------------------+
| 3 | https://example.org |
+--------------+-----------------------+
我有一根绳子https://example.com/something. 有什么方法可以到达吗https://example.com 从中选择?您可以在该/之前获取BaseUrl
SET @text := 'https://example.com/something';
SELECT LEFT(@text, POSITION('/' IN REPLACE(@text, '//', ''))+1) AS BaseUrl