Select t1.*, t2.Name ,(Select Count(*) from table2 where ID >100) h2
from table1 t1, (Select * from table2 where ID >100) as t2
where t1.ID=t2.ID
from table1 t1, (Select * from table2 where ID >100) as t2
where t1.ID=t2.ID
,(Select Count(*) from table2 where id>100) h2 --这里不能直接引用t2,因为它不是一个表
from table1 t1, (Select * from table2 where ID >100) as t2
where t1.ID=t2.ID
这两个的性质不同.
Select t1.*, t2.Name ,(Select Count(*) from t1) h2
from table1 t1, (Select * from table2 where ID >100) as t2
where t1.ID=t2.ID
或
Select t1.*, t2.Name ,(Select Count(*) from t2) h2
from table1 t1, (Select * from table2 where ID >100) as t2
where t1.ID=t2.ID