A表结构:ID,NAME,ADDTIME,CLASS
B表结构,ID,NAME,ADDTIME,CLASS,SORT
本人对SQL不是很熟,希望能够得到大侠的指教!
谢谢!
5 个解决方案
#1
select * from A where id in (select id from B)
#2
select * from a where exists(select 1 from b where id=a.id)
#3
up
#4
select a.* from a left join b on a.id=b.id
#5
select A.* from A inner join B on A.id=B.id
#1
select * from A where id in (select id from B)
#2
select * from a where exists(select 1 from b where id=a.id)
#3
up
#4
select a.* from a left join b on a.id=b.id
#5
select A.* from A inner join B on A.id=B.id