sql语句 如何写 内容下
A表字段如下
id deptid mbid(B表的id) type(基本类型5种)
20110326153526 30110326143531 1
20110326153527 30110326143532 2
20110326153528 30110326143533 3
20110326153529 30110326143534 4
20110326153530 30110326143535 5
20110326153531 07550633 30110326143531 1
20110326153532 07550633 30110326143532 2
B 表如下
id mbname mbpath createtime
30110326143531 回执模板A /print/template/
30110326143532 回执模板B /print/template/
30110326143533 回执模板C /print/template/
30110326143534 回执模板D /print/template/
30110326143535 回执模板e /print/template/
想查询出来的结果如下
id deptid mbid type mbname
20110326153531 07550633 30110326143531 1 回执模板A
20110326153532 07550633 30110326143532 2 回执模板B
20110326153528 07550633 3
20110326153529 07550633 4
20110326153530 07550633 5
如果A表中没有对应部门的ID如部门id为07550634则返回 结果为
id deptid mbid type mbname
20110326153531 07550634 1
20110326153532 07550634 2
20110326153528 07550634 3
20110326153529 07550634 4
20110326153530 07550634 5