走过,路过,不要错过啊!各位前辈,这个存储过程怎么写?

lracky 2003-11-01 11:29:56
有两个表,一个PO表:POID int Not null 订单ID
POSN varchar(30) Not null 订单编号
CustomerID int Not null 商户编号
CarryGoods int null 运输方式
Notes varchar(200) null 备注
另一个表PODetails:PODID int Not null 订单明细ID
POID int Not null 订单ID
ProductID int Not null 商品编号
Prices decimal(18,3)NOt null 价格
Notes varchar(200) null 备注
我想从PO和PODetail获取某一个供应商关于某个产品的所有订单列表(即返回PO和PODetails的内容),参数为:CustomerID,ProductID
这个存储过程怎么写啊?请教各位前辈!
...全文
20 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lracky 2003-11-01
  • 打赏
  • 举报
回复
多谢各位前辈,现在给分啦!
khyhli 2003-11-01
  • 打赏
  • 举报
回复
create proc good
@CustomerID int,
@ProductID int
as
select * from PO a,PODetails b where a.POID=b.POID
and a.CustomerID=@CustomerID and b.ProductID=@ProductID
go
---涛声依旧--- 2003-11-01
  • 打赏
  • 举报
回复
create proc SP_Find(@CustomerID int,@ProductID int)
as
select *
from Po A inner join PODetails B on B.POID = A.POID
where A.CustomerID=@CustomerID and B.ProductID=@ProductID
zjcxc 元老 2003-11-01
  • 打赏
  • 举报
回复
create proc p_sql
@CustomerID int,
ProductID int
as
select * from poid a inner join PODetails b on a.POID=b.POID
where a.CustomerID=@CustomerID and b.ProductID=@ProductID
go
yujohny 2003-11-01
  • 打赏
  • 举报
回复
create proc test(@CustomerID int,@ProductID int)
as
select *
from Po表 A inner join PODetails表 B on B.POID = A.POID
where A.CustomerID=@CustomerID and B.ProductID=@ProductID

34,623

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧