【www.gdgbn.com--php与数据库】

子查询、多表查询、联合查询
这三个概念在不同的SQL版本中的解释会略有不同,大致如下:

join连接
可以看看相关SQL的资料,或者买本SQL的书

1、如:select * from tab1 where id in (select id form tab2 where ... )
上面括号中的查询句子就属于“子查询”。

2、select tab1.*, tab2.* from tab1, tab2 where tab1.[字段]=tab2.[字段]
这里属于“多表查询”。

3、如:(select * from tab1 where ...) union (select * from tab2 where ...)
这属于“联合查询”,当然所谓的“联合查询”还有多种形式。

本文来源:http://www.gdgbn.com/jiaocheng/20370/