set @insertsql='insert into #indextable (nid) select id from pur where id!='''''+@strSql4begin
set @strSql = 'select depno,pono,P.id from pur P,#indextable T'
set @strSql = @strSql + ' where P.id=T.nid '+@strSql4+'and T.id between cast('+str(@PageLowerBound)+' as int)+1 and cast('+ str(@PageUpperBound)+' as int) order by T.id'
end 上面的2个存储语句是从一个表pur里取数据,现在假如我要在2个表里取数据,比如还要在另一个表pur2里取字段qty,id,vendor,那么该怎么改呀(在原有的基础上改)?
2个表的关联键字段是dga01c
set @strSql = 'select depno,pono,P.id from pur P,#indextable T'
set @strSql = @strSql + ' where P.id=T.nid '+@strSql4+'and T.id between cast('+str(@PageLowerBound)+' as int)+1 and cast('+ str(@PageUpperBound)+' as int) order by T.id'
end 上面的2个存储语句是从一个表pur里取数据,现在假如我要在2个表里取数据,比如还要在另一个表pur2里取字段qty,id,vendor,那么该怎么改呀(在原有的基础上改)?
2个表的关联键字段是dga01c
解决方案 »
- 40分啦!!!谁能给我解释一下from表单是什么
- 升级Sql数据库,但是装有VS 求教 0.0
- 一个更新数据的操作
- Web Part 之 后台管理(孟大哥看见了不要不理我呀)
- 为什么我的样式表不能应用到表格中?
- 架构
- 请问一个工程中可以做到aspx.cs和aspx.vb共存吗?
- 大家能不能告诉我ASP。NET怎样才能名打印。请看出现的问题:
- http://europe.webmatrixhosting.net的免费空间申请有问题?
- TextBox_OnChange()和CommandButton_Click()
- ASP代码可以和asp.net代码并存吗?
- gridview中如何在没有数据的时候,显示Header和Footer啊,在线等!
set @strSql = 'select depno, pono,P.id, p2.qty, p2.id, p2.vendor from pur P,#indextable T, pur2 p2'
set @strSql = @strSql + ' where P.id=T.nid and p.dg01c = p2.dg01c '+@strSql4+'and T.id between cast('+str(@PageLowerBound)+
' as int)+1 and cast('+ str(@PageUpperBound)+' as int) order by T.id'
end
如一个表select col1,col2 from tableA
两个表就是select col1,col2 from tableA,tableB
多个表就在from后增加
但注意select 后需指定表对应字段如,tableA.col1,tableB.col3等
强烈建议你看一下数据库方面的基本知识
set @strSql = 'select P.zd1,P.zd2,P.pono,p2.zd11,p2.zd22,p2.id from b1 P,#indextable T,b2 p2'
set @strSql = @strSql + ' where P.pono=p2.pono and p2.id=T.nid '+@strSql4+'and T.id between cast('+str(@PageLowerBound)+' as int)+1 and cast('+ str(@PageUpperBound)+' as int) order by T.id'
end 这样写为什么最后一页的数据不能显示出来?
set @strSql = 'select P.zd1,P.zd2,P.pono,p2.pono,p2.zd11,p2.zd22,p2.id from b1 P,#indextable T,b2 p2'
set @strSql = @strSql + ' where P.pono=p2.pono and p2.id=T.nid '+@strSql4+'and T.id between cast('+str(@PageLowerBound)+' as int)+1 and cast('+ str(@PageUpperBound)+' as int) order by T.id'
end