这是我的查询
Create FUNCTION [dbo].[CountUses](@couponid INT)
RETURNS INT
AS
BEGIN
RETURN
(
SELECT c.Id,
c.Name,
c.CreateDate,
Count(cu.id) NofUses
FROM Coupon as c
JOIN CouponUse as cu
ON c.id = cu.couponid
GROUP BY c.Id,
c.Name,
c.CreateDate
)
END
它给出的错误Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
问题出在哪里?
除了主要答案,我也很感激您对优化我的查询的任何评论......