开发者

Selecting from a table that contains: For each row in a different table call a table returning function

开发者 https://www.devze.com 2023-03-03 12:23 出处:网络
The title is pretty bad but heres the general idea of what I want to accomplish: I have a table full of rows with IDs,

The title is pretty bad but heres the general idea of what I want to accomplish:

I have a table full of rows with IDs, I al开发者_开发知识库so have a function that takes in those IDs and returns a table, I would like to select a "master table" of all function returned tables from all the IDs

I understand I could do this easily with cursors but efficiency is a primary concern in solving this issue. I've tried several things with no luck. Any help would be greatly appreciated. Thanks.

It sounds relatively simple so I am not sure if I am missing anything obvious.


If I've understood the question, this should do it.

SELECT *
    FROM YourTable yt
        CROSS APPLY dbo.YourTableFunction(yt.ID)
0

精彩评论

暂无评论...
验证码 换一张
取 消