当前位置:首页 >> sql查询总数 >>


举例:查询学生表中有多少位男同学: select count(*) from student_table where sex='男'

可以通过count函数来实现。 sqlOne:select * from tablename1 where id>5;此语句查询出来多条记录,之后看做一个新的表。 sqlTwo:select conut(*) from (select * from tablename1 where id>5) as tablename2;此语句即可查询出来统计的记录条...

select COUNT( from sys.all_columns a,sys.tables b where a.object_id=b.object_id and'table_name'

select,count(1) from grouop a,member b where group by

用户表:select count(*) 总表数 from sysobjects where xtype='u' 刚才那个是用户表,下面这个是系统表加用户表: select count(*) 总表数 from sysobject s where xtype in('u','s') 总视图数:select count(*) 总视图数 from sysobjects where x... * from 学生表 学号,姓名,年龄 from 学生表 学号,姓名,年龄 from 学生表 where 年龄 between 18 and 20 and 系别=‘IS’ 学号,姓名,年龄 from 学生表 where 姓名 like '李%' or 姓名 like '李%' 5 select dis...

数据 我这里叫a,b,c了,跟你表1,2,3是对应的 create table a(uid int,name varchar(10))insert into a values (1,'张一')insert into a values (2,'张二')create table b (uid int,type1 varchar(1))insert into b values (1,'a')insert into ...

使用标量函数count查看表总数 select count(*) from 表

select id , sum(total) as sumtotal from table group by id

select b.isum,a.* from a_table a inner join (select count(*) as isum from a_table) b on 1=1

网站首页 | 网站地图
All rights reserved Powered by
copyright ©right 2010-2021。