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