【数据库】合并问题

来源:百度知道 编辑:UC知道 时间:2024/06/27 11:22:43
select type_Name,room_ID,desk_ID from tb_Type
select count(document_ID) from tb_Document where document_Type ='人事'

如何将上面两表合并

select type_Name,room_ID,desk_ID,
(select count(document_ID) from tb_Document where document_Type ='人事') from tb_Type;

(select count(document_ID) from tb_Document where document_Type ='人事')只返回一个列,所以可以拿来用做字段子查询。

如果你这两个表里有相同的字段做个表链接就直接可以解决两个表的的合并问题了。