函数:
CREATE function QUERYPASSTICKET(@orderNO nVARCHAR(30))
returns nvarchar(4000)
AS
BEGIN
declare @ticketNo nVARCHAR(4000)
SELECT @ticketNo=ISNULL(@ticketNo+'&','')+TikcetNo FROM
QunaerPassengerMes WHERE OrderNO=@orderNO
RETURN @ticketNo
END
查询:
SELECT OrderNO,dbo.QUERYPASSTICKET(OrderNO),dbo.QUERYPASSNAME(OrderNO) as tiketname
FROM QunaerInterOrder where 1=1