1:子查询从另一个表中查
select id,col1,col2,col3,(select sub1 from table2 where subid=table1.id) 
from table1 2:同一个表中的子查询,需给表一个别名
select id,col1,col2,col3,(select sub1 from table1 where subid=a.id) 
from table1 a