28 lines
563 B
Plaintext
28 lines
563 B
Plaintext
== Why is this an issue?
|
|
|
|
If a ``++WHERE++`` clause contains a condition which is redundant in the context of the the rest of the clause, then it can be removed. If it is redundant because it does not match the programmer's intent, then it's a bug and the sub-condition should be fixed.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,text]
|
|
----
|
|
SELECT name, price
|
|
FROM product
|
|
WHERE price > 15 -- Noncompliant
|
|
AND price < 100 -- Noncompliant
|
|
AND price = 50
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,text]
|
|
----
|
|
SELECT name, price
|
|
FROM product
|
|
WHERE price = 50
|
|
----
|
|
|
|
|