数据库中 这个的典型方法就是使用 主外键联系....还有一个方法就是 使用触发器...
使用关联查询:join ,left join, right join,或内连接select a.*,b.* from a left jion b on a.x=b.y