SQL Server Bool Selecione
SELECT
M.*,
hasAttachments = EXISTS(SELECT AttachmentId
FROM Attachment
WHERE messageId = M.messageId),
FROM Message M
LeisureSuit Larry