Hi! I'm trying to return the number of rows returned by a UDF which returns a table:
The UDF returns a TABLE defined with only 1 column (storeID INT)
I want to get the number of rows returned by the UDF:
StoreIDListForGroup( <groupID> )
Example usage that works:
SELECT sg.id, sg.title, (SELECT COUNT(storeID) FROM dbo.StoreIDListForGroup(1)) AS storeCount
FROM StoreGroups sg
ORDER BY sg.title
This will give me the store group id, title and the count of number of stores in group 1.
I need it to count the number of rows per group.
Example which doesn't work:
SELECT sg.id, sg.title, (SELECT COUNT(storeID) FROM dbo.StoreIDListForGroup(sg.id)) AS storeCount
FROM StoreGroups sg
ORDER BY sg.title
What's the correct syntax for this?
Thanks,
David
The UDF returns a TABLE defined with only 1 column (storeID INT)
I want to get the number of rows returned by the UDF:
StoreIDListForGroup( <groupID> )
Example usage that works:
SELECT sg.id, sg.title, (SELECT COUNT(storeID) FROM dbo.StoreIDListForGroup(1)) AS storeCount
FROM StoreGroups sg
ORDER BY sg.title
This will give me the store group id, title and the count of number of stores in group 1.
I need it to count the number of rows per group.
Example which doesn't work:
SELECT sg.id, sg.title, (SELECT COUNT(storeID) FROM dbo.StoreIDListForGroup(sg.id)) AS storeCount
FROM StoreGroups sg
ORDER BY sg.title
What's the correct syntax for this?
Thanks,
David