简体   繁体   English

如何在mysql中创建多个substring_index

[英]Howto make multiple substring_index in mysql

Howto perform this in mysql如何在 mysql 中执行此操作

(substring_index(domain,'.',-3) OR (substring_index(domain,'.',-2)) IN (".implode(",", $domains)."))

When i run it with only当我只运行它时

substring_index(domain,'.',-2) IN (".implode(",", $domains)."))

it works and它有效并且

substring_index(domain,'.',-3) IN (".implode(",", $domains)."))

But the OR function makes the query return none但是OR函数使查询返回 none

Solution found.找到解决方案。 My problem was that my max_allowed_packet size was to small, and i got many entyes 40k at the IN statement.我的问题是我的 max_allowed_pa​​cket 大小太小,而且我在 IN 语句中得到了很多 40k 的实体。

You have to add 2 statements您必须添加 2 条语句

substring_index(domain,'.',-2) IN (".implode(",", $domains).") 
OR 
substring_index(domain,'.',-3) IN (".implode(",", $domains).")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM