首页
学习
活动
专区
圈层
工具
发布
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    全网最全的数据库操作命令,一口气从头看到尾,蛮有收获的!

    排序: select * from table1 order by field1,field2 [desc] 总数: select count as totalcount from table1 求和:...10到15的记录 select top 5 * from (select top 15 * from table order by id asc) table_别名 order by id desc 三...7.记录搜索: 开头到N条记录 Select Top N * From 表 N到M条记录(要有主索引ID) Select Top M-N * From 表 Where ID in (Select Top...M ID From 表) Order by ID Desc N到结尾记录 Select Top N * From 表 Order by ID Desc 例如1:一张表有一万多条记录,表的第一个字段...解决方案 1,用order by select top 30 recid from A order by ricid 如果该字段不是自增长,就会出现问题 2,在那个子查询中也加条件:select top

    2K43

    数据库基本----SQL语句大全

    排序:select * from table1 order by field1,field2 [desc] 总数:select count as totalcount from table1 求和:...10 b.* from (select top 20 主键字段,排序字段 from 表名 order by 排序字段 desc) a,表名 b where b.主键字段 = a.主键字段 order...by a.排序字段 14、说明:前10条记录 select top 10 * form table1 where 范围 15、说明:选择在每一组b值相同的数据中对应的a最大的记录的所有信息(类似这样的用法可以用于论坛每月排行榜...10 * from tablename order by newid() 18、说明:随机选择记录 select newid() 19、说明:删除重复记录 Delete from tablename...10到15的记录 select top 5 * from (select top 15 * from table order by id asc) table_别名 order by id desc

    6.6K32
    领券