2015-10-05 104 views
0

我需要將第一個查詢的結果用於第二個查詢。如何從第一個查詢到第二個查詢的用戶結果

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,但我需要matchedcategoryidmatchconfigcategories。我怎樣才能做到這一點? 我有錯誤是這樣的

多部分組成的標識符

+1

你可以張貼一些示例數據和預期的結果?看看你的示例查詢,很難確切地確定你想要完成的是什麼。此外,如果您可以發佈整個錯誤消息,而不僅僅是前幾個單詞,那麼也會有所幫助。 – DeadZone

回答

0
DECLARE @cat tp_intList; 
INSERT INTO @cat 
select ... 

這個工作正常,我

相關問題