不知道这个sql语句该怎么写,就是求属于这个类别的记录有多少条。
表一   a   
 id      title 
 1         book 
 2         frout 
 3         pen 
 4         mouse     
 表二   b   
 sid         id            content 
 1                  1            thisisbook    
 2                  1            fsafssdfsdf 
 3                  2            hfdgdgfdg 
 4                  2            wdsfsdfsf   
 表一和表二通过id关联。表一的id   和表二的sid都是主键,自增。   
 要求选出   表一的   id,title,记录数   
 这个记录数的意思是表一的id在表二里有多少条记录(也就是属于这个类别的记录有多少条的意思),并且这个记录数要大于10小于50。   不知道sql语句怎么写?
------解决方案--------------------select A.id,A.title,count(*) 
 from A,B 
 where A.id=B.id 
 group by A.id,A.title 
 having count(*)> 10 and count(*) <50
------解决方案--------------------select a.id,title,记录数 
 from a 
 inner Join 
 (select id,count(1) 记录数 from b group by id having count(1) between 10 and 50)bb 
 On a.id=bb.id