Skip to content
Advertisement

WHERE a AND b returns just WHERE b

I have 2 tables which I want to join and return only those records which:

  1. Have the same value with other records in one of the columns.
  2. Have certain values in other column.

These are my requests:

List only those records which have the same value with other records in grnz column:

List only those records which have violation_status_id equal to 10 or 11

But when I try to combine them

condition

is completely ignored and output is similar to request N 2.

Any advice?

P.S. sample enter image description here

Advertisement

Answer

During the building of the schema I found an error: I was picking duplicates before implementing the value filter.

Here is the correct request:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement