CREATE FUNCTION LeastExpensiveTitle(
@pub_id CHAR(4)
)
RETURNS TABLE
RETURN SELECT TOP 1 title FROM pubs..titles
WHERE pub_id = @pub_id
ORDER BY PRICE

SELECT T.title, P.pub_name FROM
pubs..publishers AS P
CROSS APPLY
LeastExpensiveTitle(P.pub_id) AS T
a
b
