select (select code from SC_StockItem where StockItemID = a.StockItemID)
from SC_StockItemVariantSetAttribValue a
inner join SC_StockItemVariantSetAttribValue a2 on a.StockItemID = a2.StockItemID
and a2.VariantSetAttribValueID = 18
inner join SC_StockItemVariantSetAttribValue a3 on a2.StockItemID = a3.StockItemID
and a3.VariantSetAttribValueID = 12
where a.VariantSetAttribValueID = 26
我希望执行上面的查询。类似于以下的行:
inner join SC_StockItemVariantSetAttribValue a2 on a.StockItemID = a2.StockItemID
and a2.VariantSetAttribValueID = 18
将相应地添加从另一个查询返回的行数。有没有办法可以在 TSQL 函数中添加这些行?