选择行,如果“值” %2 = 1. MOD() [英] select row if the "value" % 2 = 1. MOD()

查看:136
本文介绍了选择行,如果“值” %2 = 1. MOD()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在选项中有一个包含整数的列。我想选择该行,只有当该值%2 = 1。
我知道这可以在2个查询,但是可以在1吗?

There is a column in options that hold an integer. I want to select the row only if that value % 2 = 1. I know this can be done in 2 queries but is it possible to do it in 1?

推荐答案

MySQL,SQL Server,PostgreSQL,SQLite支持使用百分号作为模数:

MySQL, SQL Server, PostgreSQL, SQLite support using the percent sign as the modulus:

WHERE column % 2 = 1

对于Oracle,您必须使用 MOD功能

For Oracle, you have to use the MOD function:

WHERE MOD(column, 2) = 1

这篇关于选择行,如果“值” %2 = 1. MOD()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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