Hello! I am using MySQL 5.
In the table I have the following lines
column1 --- column2 1 --- 2 1 --- 3 2 --- 2
I have 2 input lists:
- A list of "positive" column2 values.
- A list of "negative" column2 values.
It is required to display all column1, which (in the whole table) have a "connection" (are in one line-entry in the table) with some positive column2. And while there is not a single line in the table, where there is a column1 and some negative column2.
For example, the positive list is “2”, the negative one is “3.”
With this approach, there should be only one line in the sample.
2 --- 2
I tried to write a request and that's what came up:
SELECT * FROM table WHERE column2 IN (2) AND WHERE column2 NOT IN (3);
But I get at the exit 2 lines:
1 --- 2 2 --- 10