有两个表:
dataTmp,data,两表结构一样
saccount 是主键。我想查询saccouont在dataTmp有,在data里也有的记录,select * from dataTmp where saccount in (select saccount from data);
问题来了:
如果我要比较的字段是一个组合键saccount ,icheckdata
那要求saccount和icheckdata在两表中都有的记录应该怎么查?请各位高手热心指点
dataTmp,data,两表结构一样
saccount 是主键。我想查询saccouont在dataTmp有,在data里也有的记录,select * from dataTmp where saccount in (select saccount from data);
问题来了:
如果我要比较的字段是一个组合键saccount ,icheckdata
那要求saccount和icheckdata在两表中都有的记录应该怎么查?请各位高手热心指点
where exists(select * from data where saccount = A.saccount
and icheckdata = a.icheckdata);
where exists
(select * from data
where saccount = a.saccount
and icheckdata = a.icheckdata);