我有以下查询,我希望它显示“尚未”,而不是显示数据库中 Status 列的 NULL 值。怎么做?
SELECT dbo.SafetySuggestionsLog.Title, dbo.SafetySuggestionsLog.Description, dbo.SafetySuggestionsLog.Username, dbo.SafetySuggestionsStatus.Status,
CASE WHEN dbo.SafetySuggestionsStatus.Status IS NULL THEN 'NOT YET'
FROM dbo.SafetySuggestionsLog INNER JOIN
dbo.employee ON dbo.SafetySuggestionsLog.Username = dbo.employee.Username LEFT OUTER JOIN
dbo.SafetySuggestionsStatus ON dbo.SafetySuggestionsLog.StatusID = dbo.SafetySuggestionsStatus.ID
WHERE (dbo.employee.Username = @Username)
供您参考,该数据库设计如下:
Employee Table: Username, Name
SafetySuggestionsLog Table: ID, Title, Description, Username, StatusID
SafetySuggestionsStatus: ID, Status