这个是单个表的分页代码
StringBuilder sqlStr = new StringBuilder();
strSql.Append("select top 10 * from authors where au_id not in (select top " + page * 10 + " au_id from authors)");但是多个表我不知道怎样写,请指教一下:
StringBuilder sqlStr = new StringBuilder();
sqlStr.Append("select top 10 ct.CommodTypeName '商品类型',c.comName '商品名字',c.ComPrice '商品价格',cs.ComNum '商品出销数量',cs.ComTotalPrice '商品出销总价格',ci.MachineName '机器号' ");
sqlStr.Append("from CommoditiesType as ct,Commodities as c,CommoditiesSell as cs,ClientList as ci where 1=1 ");
sqlStr.Append("and ct.CommodTypeID=c.ComKindID and c.CommodID=cs.ComID ");
sqlStr.Append("and cs.ComID not in (select top "+page*10+" ComID from CommoditiesSell)");
StringBuilder sqlStr = new StringBuilder();
strSql.Append("select top 10 * from authors where au_id not in (select top " + page * 10 + " au_id from authors)");但是多个表我不知道怎样写,请指教一下:
StringBuilder sqlStr = new StringBuilder();
sqlStr.Append("select top 10 ct.CommodTypeName '商品类型',c.comName '商品名字',c.ComPrice '商品价格',cs.ComNum '商品出销数量',cs.ComTotalPrice '商品出销总价格',ci.MachineName '机器号' ");
sqlStr.Append("from CommoditiesType as ct,Commodities as c,CommoditiesSell as cs,ClientList as ci where 1=1 ");
sqlStr.Append("and ct.CommodTypeID=c.ComKindID and c.CommodID=cs.ComID ");
sqlStr.Append("and cs.ComID not in (select top "+page*10+" ComID from CommoditiesSell)");
解决方案 »
- 导出数据如何保证数据的完整性
- _variant_t 转化为csting
- sql语句 错误分析,谢谢!在线等!!!
- 请教一个触发器的问题
- 求一SQL语句
- SUM提示“#错误”,不知道是怎么会事情
- 在SQL2000中附加原来也是2000的数据库文件(.mdf文件),出错误:602问题
- sql2000备份数据库导入sql2005时报错
- 求一个比较复杂的SQL,请大家!!!!!!!大师!!!!们进来看看,帮帮忙,在此谢了!!!??????????????????
- 添加表字段信息时出现的小问题!!!看到的朋友请进来帮帮忙!!!!在线等。。。。。
- 如何用查询分析器把服务器上的库导入到本地库
- 限制数据表中的某一列的数据来源于本数据库的其他表,应该怎么做?
所以就随便写了一个上去,希望能尽快解决