select name1,count(*) as sl from a where name2>2 group by name1
select name1,count(*) as sl from a where name2>3 group by name1
select name1,count(*) as sl from a where name2>4 group by name1
select name1,count(*) as s2 from a where name2>2 group by name1 into cursor lsb1
select name1,count(*) as s3 from a where name2>3 group by name1 into cursor lsb2
select name1,count(*) as s4 from a where name2>4 group by name1 into cursor lsb3
SELECT lsb1.name1,s2,s3,s4 FROM lsb1 ;
JOIN lsb2 ON lsb1.name1=lsb2.name1;
JOIN lsb3 ON lsb1.name1=lsb3.name1
Select Name1,Sum(Iif(Name2>2,1,0)) As sl2,Sum(Iif(Name2>3,1,0)) As sl3,Sum(Iif(Name2>4,1,0)) As sl4 Into Table 表2 From 表1 Group By Name1 Order By Name1
*--以下为导出EXCEL表
Select 表2
Copy To Excel表名.Xls Type Xl5