SQL查询两个表相同的两个字段里不同的数据有哪些
SQL查询两个表相同的两个字段里不同的数据有哪些
日期:2019-08-05 22:48:56 人气:3
select * from A
inner join B on A.Name = B.Name and A.ID = B.ID
where A.Name = '张三' and A.ID = '008'
内连接即可
或者:
1、除重
select distinct A.ID AS AID,A.Name AS AName,B.ID AS BID,B.Name AS BName from A inner join B on(A.Name=B.Name and A.ID=B.ID)