DaishaPocedureOfMine(代码)
create procedure GetGoodsInfoByPageNumber
(
@provideID int,
@pageNumber int,
@GoodsCountOfOnePage float,
@howManyGoods int output,
@howManyPage int output )
as
declare @Goods table
(
RowNumber int,
GoodsId int,
GoodsName varchar(50),
GoodsDescribe varchar(200),
PhotoName varchar(200),
SkuId int,
Price money,
MarketPrice money,
SkuStirng varchar(200)
)
insert into @Goods
select ROW_NUMBER() over (order by Goods.GoodsId),
GoodsId,GoodsName,GoodsDescribe,PhotoName,SkuId,Price,MarketPrice,SkuStirng from Goods,Photos,Sku where Goods.GoodsId in (select GoodsId from Goods where Goods.ProvideCateId = @provideID) and Photos.ProvideGoodsId = Goods.GoodsId and Photos.FatherPhotoId is null and Photos.PhotoIdentity = 1 and Sku.ProvideGoodsId = Goods.GoodsId and Sku.SkuIdentity = 1
----给输出参数赋值
select @howManyGoods = COUNT(GoodsId) from @Goods
select @howManyPage = Ceiling(@howManyGoods / @GoodsCountOfOnePage) select GoodsId,GoodsName,GoodsDescribe,PhotoName,SkuId,Price,MarketPrice,SkuStirng from @Goods
where RowNumber > (@pageNumber - 1) * @GoodsCountOfOnePage
and RowNumber <= @pageNumber * @GoodsCountOfOnePage
go use Daisha
declare @howManyGoods int
declare @howManyPage int
exec GetGoodsInfoByPageNumber 10,4,5,@howManyGoods out,@howManyPage out
select @howManyGoods as 商品总数
select @howManyPage as 共几页 -----select * from Goods where GoodsId = 177
-----select * from Photos where Photos.ProvideGoodsId = 177
DaishaPocedureOfMine(代码)的更多相关文章
- 日期格式代码出现两次的错误 ORA-01810
错误的原因是使用了两次MM . 一.Oracle中使用to_date()时格式化日期需要注意格式码 如:select to_date('2005-01-01 11:11:21','yyyy-MM-dd ...
- 可爱的豆子——使用Beans思想让Python代码更易维护
title: 可爱的豆子--使用Beans思想让Python代码更易维护 toc: false comments: true date: 2016-06-19 21:43:33 tags: [Pyth ...
- iOS代码规范(OC和Swift)
下面说下iOS的代码规范问题,如果大家觉得还不错,可以直接用到项目中,有不同意见 可以在下面讨论下. 相信很多人工作中最烦的就是代码不规范,命名不规范,曾经见过一个VC里有3个按钮被命名为button ...
- Jquery的点击事件,三句代码完成全选事件
先来看一下Js和Jquery的点击事件 举两个简单的例子 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN&q ...
- redux-amrc:用更少的代码发起异步 action
很多人说 Redux 代码多,开发效率低.其实 Redux 是可以灵活使用以及拓展的,经过充分定制的 Redux 其实写不了几行代码.今天先介绍一个很好用的 Redux 拓展-- redux-amrc ...
- 编写高质量代码:改善Java程序的151个建议(第5章:数组和集合___建议75~78)
建议75:集合中的元素必须做到compareTo和equals同步 实现了Comparable接口的元素就可以排序,compareTo方法是Comparable接口要求必须实现的,它与equals方法 ...
- 使用 .NET WinForm 开发所见即所得的 IDE 开发环境,实现不写代码直接生成应用程序
直接切入正题,这是我09年到11年左右业余时间编写的项目,最初的想法很简单,做一个能拖拖拽拽就直接生成应用程序的工具,不用写代码,把能想到的业务操作全部封装起来,通过配置的方式把这些业务操作组织起来运 ...
- jsp前端实现分页代码
前端需要订一page类包装,其参数为 private Integer pageSize=10; //每页记录条数=10 private Integer totalCount; //总记录条数 priv ...
- 【开源】简单4步搞定QQ登录,无需什么代码功底【无语言界限】
说17号发超简单的教程就17号,qq核审通过后就封装了这个,现在放出来~~ 这个是我封装的一个开源项目:https://github.com/dunitian/LoTQQLogin ————————— ...
随机推荐
- shell判断USB接口是否有设备插入
#/bin/sh usb_num=$(cat /proc/scsi/scsi | grep "Vendor" | wc -l)if [ $usb_num = 2 ];then ...
- ServiceStack.Redis连接阿里云redis服务时使用连接池出现的问题
创建连接池 private static PooledRedisClientManager prcm = CreateManager(new string[] { "password@ip: ...
- 不能收缩 ID 为 %s 的数据库中 ID 为 %s 的文件,因为它正由其他进程收缩或为空。
SQLServer数据库通常都不建议进行SHRINKFILE操作,因为SHRINKFILE不当会造成一定的性能问题. 但是当进行了某些操作(例如某个超大的日志类型表转成分区表切换了数据文件),数据库某 ...
- python模块(os,sys,hashlib,collections)
列出目录下所有文件 os.listdir('dirname'):列出指定目录下的所有文件和子目录,包括隐藏文件,并以列表方式返回. 创建文件夹: os.mkdir('文件夹') 创建文件夹 os ...
- 【原】Java学习笔记012 - 数组
package cn.temptation; public class Sample01 { public static void main(String[] args) { // 需求:小店对自己的 ...
- chrome打开收藏夹的网站在新的标签页
chrome浏览器在新的标签页打开收藏夹的网址,现在设置不了,而且右键,在新标签页中打开有点烦..下面说说直接打开的方式. 方法1: 鼠标滚轮,直接点击收藏夹的网址,即可 方法2: ctrl + 鼠标 ...
- MongoDB的常用命令和增查改删
数据库操作 Mongodb MySQL 查询库 show databases | show dbs show databases 选中库 use databaseName use databaseNa ...
- Putty中的pscp和psftp的简明用法
用习惯了putty,那是真心的方便啊,putty文件夹下其他的小兄弟也不能忽略啊. 以前的时候,从远程服务器下载个文件用winscp,后来,发现在putty文件夹里好像有一个 pscp和psftp,今 ...
- find mtime参数+号,-号,不带符号的用法
find . -mtime +0 -type f -name "oms*" | xargs rm -f 删除24小时以前 oms格式的文件 #按文件更改时间来查找文件,- ...
- Cookie 版购物车
写一个JS文件 把相应的方法写在JS文件内 为了方便以后的调用 具体代码为 var Cart = function () { this.Count = 0; this.Total = 0; this ...