我的要求是:
select (*ALL columns of table1, [count of rows of TABLE2 where TABLE1.id = Table2.id]
from TABLE1, TABLE2
where TABLE1.status = 'A'
现在是SQL,如果问题太简单,请原谅
答案 0 :(得分:2)
select t1.col1, t1.col2, t1.col3, count(t2.id)
from table1 t1
left join TABLE2 t2 on t1.id = t2.id
where t1.status = 'A'
group by t1.col1, t1.col2, t1.col3
答案 1 :(得分:1)
使用相关子查询:
globals