感谢您的消息我解决了我的问题这样
ALTER FUNCTION [VEZNE].[fnMakbuzIslemGetir]
(
@refNo as int
)
RETURNS @tablename TABLE (kontrol1 char(1),key0 numeric(18,0) ,tarih datetime ,hizkod char(12),hizad char(75),ytlhizfiyat decimal(18,2) ,hizmiktar numeric(18,2),ytlhiztutar decimal(18,2))
AS
BEGIN
DECLARE @durum AS VARCHAR
DECLARE @hastaTuru AS VARCHAR
DECLARE @makTipi AS VARCHAR
SET @durum = (SELECT durum FROM TH_RefKart WHERE RefNo = @refNo)
SET @hastaturu = (SELECT HastaTuru FROM TH_Dosya WHERE DosyaNo in (SELECT DosyaNo FROM TH_RefKart WHERE RefNo = @refNo))
SET @makTipi = (SELECT maktipi FROM TH_Islem WHERE refNo = @refNo )
IF ((@hastaTuru = 'Ücretli') AND (@durum = 'AYAKTA')) OR @makTipi = '0'
BEGIN
INSERT @tablename SELECT kontrol1, key0, tarih, hizkod, hizad, ytlhizfiyat, hizmiktar, ytlhiztutar
FROM TH_Islem
WHERE refno= @refNo and DekontNo = '0' and anahtar<> -1
END
RETURN
END
但现在我在这一行遇到了另一个问题
SET @makTipi = (SELECT maktipi FROM TH_Islem WHERE refNo = @refNo)
因为这个 SELECT 返回多行值。我现在能做什么?