我需要将第一个查询的结果用于第二个查询。
declare @categories tp_intList;
insert into @categories values (1), (2), (3), (4), (5);
select * from product AS prod
inner join
(
select MatchedCategoryId from MatchConfigCategories AS dd
inner join @categories c on c.id = dd.maincategoryid
inner join (select id from get_AllSubCategories(dd.MatchedCategoryId)) AS cats on prod.shopcatid = cats.id
) AS x on prod.ShopCatid = 4568
我需要将其用于get_AllSubCategories
。参数为tp_intList
,但我需要来自matchedcategoryid
的{{1}}。我怎样才能做到这一点?
我有这样的错误
多部分标识符
答案 0 :(得分:0)
DECLARE @cat tp_intList;
INSERT INTO @cat
select ...
this works fine for me