悉野小楼

导航

从sql查询结果集中查询


select * from 
(
        
select stu.*, ter.name
        
from student as stu, ter as term
        
where stu.t_id = ter.id  
as t 
where t.id > 10


错误:


select * from 
(
        
select stu.*, ter.*
        
from student as stu, ter as term
        
where stu.t_id = ter.id  
as t 
where t.id > 10

因为student和term表中都存在id 合的表要用来查询,不充许有重复列

下面是可以的:
 
select stu.*, ter.*
 
from student as stu, ter as term
 
where stu.t_id = ter.id 
他不作为条件,再用来查询了

 

posted on 2010-11-11 17:22  悉野  阅读(3049)  评论(0编辑  收藏  举报