导航
  • 主页
  • 基础类
  • 应用实例
  • 新技术前沿

存储过程出错!

哈哈哈啊002 2007-12-21 02:26:49
@dfid int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here

select dbo.tb_drugfactory.*,(select ID as 'OrganID',Name as "OrganName" from dbo.tb_organization
where RegionID=dbo.tb_drugfactory.RegionID)
from dbo.tb_drugfactory
where ID=@dfid
END

提示出错:
当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。
我知道可以将两个表做联接来解决,但是有没有别的方法比联接更好的!
...全文
64 点赞 收藏 3
写回复
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wzy_love_sly 2007-12-21
用楼上,你那个不行
回复
tim_spac 2007-12-21

@dfid int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here

select dbo.tb_drugfactory.*,b.ID as 'OrganID',b.Name as "OrganName"
from dbo.tb_drugfactory a
join dbo.tb_organization b on b.RegionID=a.RegionID
where ID=@dfid
END
回复
jinjazz 2007-12-21
select top 1 ID
回复
发动态
发帖子
MS-SQL Server
创建于2007-09-28

3.2w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
社区公告
暂无公告