【发布时间】:2016-01-30 02:38:19
【问题描述】:
在 Java 中,
int a = 10, b = 10;
if (a == 10 || b==10)
{
// first condition (a==10) is true, so it wont check further
}
但是,在 SQL 中,
select * from my table where a = 10 or b = 10;
--As per my understanding, It should return data only based on a.
--But it returns both entries.
这是为什么呢?
【问题讨论】:
-
这不是 WHERE 语句的工作方式。我假设您要做的是获取 a=10 的所有行,除非 a!=10,然后获取 b=10 的所有行。
标签: java sql if-statement plsql conditional