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