select * from a where exists(select * from b where a.dm=b.dm)
试试看行不行