left join 如果子表中没有此记录,则取 上面最近一条 记录 本帖最后由 gguozhenqian 于 2011-01-11 16:17:37 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select p.id,p.datatime,a.*,b.* from (select p.id,p.datatime,aid=(select max(pid) from child1 where pid<=p.id),bid=(select max(pid) from child2 where pid<=p.id) from parent p ) p left join child1 a on a.pid=aid left join child2 b on b.pid=bid 怎样在存储过程中实现按序号遍历记录集 如何查看当前哪个表出现了死锁?(我给100分) 如何使事务回滚时不回滚指定表的数据 问:如何在存储过程中定义变量类型为ntext 再备份文件和文件组时出错了???帮忙啊 !!!!! 几个问题请教大家,麻烦解答,多谢了 请交gahade(与君共勉)一个问题 请问:php+mysql如何实现全文搜索? 怎么查看SQL SERVER 2000中事务日志的内容?*.TRN 文件 流星尔求助: sql server 2000 触发器 如何查看数据库用了多少页?
select p.id,p.datatime,
aid=(select max(pid) from child1 where pid<=p.id),
bid=(select max(pid) from child2 where pid<=p.id)
from parent p ) p
left join child1 a on a.pid=aid
left join child2 b on b.pid=bid