我想为全文搜索创建一个索引视图。
我面临子查询的唯一问题,因为索引视图不允许子查询。
以下是我的查询
ALTER VIEW [dbo].[Demo] with SCHEMABINDING AS
select distinct a.ID,a.Title, a.Description ,b.Name as Recipe, c.Name as Taste , d.Name as CuisineType,
STUFF((SELECT ',' + Name FROM dbo.Ingredients where ID in (select IngredientID from dbo.listingIngredients
where listingid = a.ID ) FOR XML PATH('')), 1, 1, '') as Ingredients
from dbo.Listing as a
inner join dbo.RecipeType b on a.RecipeTypeID = b.ID
inner join dbo.taste c on a.tasteID = c.ID
inner join dbo.CuisineType d on a.CuisineTypeID = d.ID
inner join dbo.listingIngredients e on a.ID = e.listingID
GO
我正在使用子查询使用 STUFF 从成分表中获取成分作为连接字符串。
有人可以告诉我如何删除这个子查询并将成分作为满足的字符串。
请告诉我
问候曼尼什