在 mysql 中的运算符替代 [英] In operator alternative in mysql

查看:68
本文介绍了在 mysql 中的运算符替代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Select col1,col2,col3 from table1 where col4 in (1,2,3,4);

在 mysql 选择查询中,除了 'in' 之外,还有其他方法吗?

Is there any other way to do instead of 'in' in mysql select query?

如果我在运算符中使用,有一些性能限制,如果您有其他建议,不胜感激.

If i use in operator, there is some performance limit, appreciate if you have other suggestions.

推荐答案

使用 IN 运算符不应该有性能问题.

using IN operator should NOT have performance issues.

如果您坚持不使用 IN 运算符,请将您的查询替换为:

If you insist NOT using IN operator, replace your query with:

Select col1,col2,col3 from table1 where col4=1 OR col4=2 OR col4=3 OR col4=4;

这篇关于在 mysql 中的运算符替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆