📜  sql server isnull function nor working count - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:58.910000             🧑  作者: Mango

代码示例1
SELECT  FirstName, 
        LastName,
        IsNull((
            SELECT  COUNT(UP1.EmailAddress) AS HasEmail 
            From    dbo.UserProfiles AS UP1 
            WHERE   (NOT (UP1.EmailAddress IS NULL)) 
                    AND (CreatedBy = dbo.UserProfiles.UserID)
            GROUP BY CreatedBy), 0) AS EmailEnteredCount 
FROM    dbo.UserProfiles 
WHERE   (IsStaff = 1)