select * from subject a join attachment b on a.tid=b.tid
join message c on b.tid=c.tid
或者
select * from subject a ,attachment b ,message c
where a.tid=b.tid and b.tid=c.tid
select *
from A, B, C
where A.tid=B.tid
and B.tid=C.tid
用子查处或是连接