我有两个访问表和两个连续数字(1057,1045,4252等)我想拉出两个表中的类似记录。例如,如果表x具有记录1057并且表y还包括1057而不是我想要看到那些记录。任何帮助将不胜感激。感谢
答案 0 :(得分:0)
select t1.*,t2.* from table1 as t1
inner join table2 as t2 on (t1.COMMONCOLUMNID = t2.COMMONCOLUMNID)
EDITED
select * from TableName where DiscreteUID in (select predecessor from TableName)
or
DiscreteUID in (select successor from TableName)
EDITED
(select DiscreteUID, 1 as IsPredecessor, 0 as IsSuccessor from TableName where DiscreteUID in (select predecessor from TableName))
UNION
(select DiscreteUID, 0 as IsPredecessor, 1 as IsSuccessor from TableName where DiscreteUID in (select successor from TableName))