How SQL can compare the two tables of the same name value corresponding to the id value is not the same?
CodePudding user response:
The SELECT tb1. The name, id1 id2 as sub - from tb1, tb2 where tb1. The name=tb2. Name
Sub=0, same!=0 is not the same
If id1, id2 is a string of words, in the case when the
CodePudding user response:
Select * from (The select tb1. The name, tb1 id1, tb2. Id2 from tb1 join tb2 on tb1. The id1=tb2. Id2) tt1
Where id1 & lt;> id2
CodePudding user response:
Select a. *, * from b. tb1 a, tb2 b where a. ` name `=b. ` name ` and Anderson, d! B.i=dCodePudding user response:
Select * from (The select tb1. The name, tb1 id1, tb2. Id2 from tb1 join tb2 on tb1. The id1=tb2. Id2) tt1
Where id1 & lt;> Id2
Agree with 2