sql="select sum(***) as ** from ** as a,** as b where a.id=b.id" Rs(A.id) Rs(B.id) [提示.双表中的值.不可选.不可为空.否则失效] id唯一的值 sum求和 as 赋值给 a表 ** as a 字段 a.** B表 ** as b b.** count(*) 所有记录数 情况2. select * From biao1,biao2 where biao1.id=biao2.id order by bia…
单表查询 先创建表 #创建表 create table employee( id int not null unique auto_increment, name varchar(20) not null, sex enum('male','female') not null default 'male', #大部分是男的 age int(3) unsigned not null default 28, hire_date date not null, post varchar(50), pos…
select top 10 * ,row()_number over ( order by 字段 desc) as rownum from 表 row()_number;简单的说row_number()从1开始,为每一条分组记录返回一个数字 ( order by 字段 desc,order by 字段2 desc):需要排序的字段, 也可以:( order by 字段 desc,order by 字段2 desc)先根据字段排序,再根据字段二排序 然后页面需要调用的就是 rownum 字段…