I want to check one by one the result on table A if it exist on table B.
Example:
Table A
Name | ID |
---|---|
A | 100 |
A | 101 |
A | 102 |
B | 101 |
B | 100 |
B | 103 |
B | 104 |
Table B
select * from incompatible_table where ID = '100';
ID | Incompatible_ID |
---|---|
100 | 105 |
100 | 101 |
100 | 106 |
My problem is that I have to check one by one for the Name A first if 101 and 102 does not exist on the incompatible_table for 100. Then check if 100 and 102 exist on 101 and lastly 100 and 101 for 102.
Then after that same for B, group it first the check if the ID's are existing to one another.
I'm using MySQL
I want to know if there are Names that have an ID which are incompatible with each other.
In table A, I want to filter out first all names that are A and their IDs and compare it to search each ID to table B. That leaves me with
Name | ID |
---|---|
A | 100 |
A | 101 |
A | 102 |
I have to check in table B if there are no 101 and 102 on this query:
select * from incompatible_table where ID = '100';
and no 100 and 102 in this query:
select * from incompatible_table where ID = '101;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.