我在存储过程中编写子查询以获取存储为 varchar 数据类型的订单之间的值。当我运行查询时,它显示:
子查询返回超过 1 个值。当子查询跟随 =、!=、<、<=、>、>= 或子查询用作表达式时,这是不允许的。
我用谷歌搜索了一下,发现问题是因为在子查询中返回了超过 1 个值。
但在我的情况下,我需要位于给定输入之间的所有值。谁能告诉我我可以用什么方法来实现这一点..
代码:
SELECT ROW_NUMBER()OVER(
ORDER BY po.id) AS SNo ,
pd.Copies AS Quantity,
pd.EstUnitPrice AS UniPrice,
pd.Copies*pd.EstUnitPrice AS Total,
(SELECT value
FROM BibContents
WHERE bibid=pd.BibId
AND sfld='a'
AND tagno='245') AS Title,
(SELECT value
FROM BibContents
WHERE bibid=pd.BibId
AND sfld='a'
AND tagno='020') AS 'ISSN/ISBN',
(SELECT value
FROM BibContents
WHERE bibid=pd.BibId
AND sfld='a'
AND tagno='100')AS Author
FROM [VibrantMas].[dbo].[PoDetails] AS pd
INNER JOIN Porders AS po ON po.Id=pd.PoId
WHERE po.No BETWEEN '000021' AND '000024'