Selecting from a table that contains: For each row in a different table call a table returning function
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)
精彩评论