两条SQL语句

select count(*) as "所查人数"
  from (select * from table_a a, table_b b where a.pid = b.pid) t
 where t.name like '张%'
   and t.age >= 24
   and t.age <= 50;

select avg(t1.age) as "所查平均年龄"
  from (select * from table_a a, table_b b where a.pid = b.pid) t1
 where t1.name like '张%'
   and t1.sex = '';

 

posted @ 2012-12-06 08:33  微明Axel  阅读(149)  评论(0编辑  收藏  举报