标题:关于select的嵌套用法 出处:BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog 时间:Tue, 05 Jun 2007 17:46:46 +0000 作者:ArthurXF 地址:http://www.bizeway.net/read.php/118.htm 内容: select的嵌套用法: 引用 select A from (select * from tableB) as t1 或者 select A from (select * from tableB) t1 例子: 引用 SELECT * FROM ( SELECT * FROM affiche ORDER BY `submit_date` DESC ) AS t1 GROUP BY type_id ORDER BY `submit_date` DESC LIMIT 0 , 30 如果要从表userinfo(此表也含有userid)中选出与表result的userid不同的所有数据,例子如下: 引用 select * from userinfo where userinfo.userid not in(select result.userid from result) Generated by Bo-blog 2.0.3 sp1