For everyone who is willing to help - here is a formatted query:SELECT TOP (100) PERCENT managername, '(' + RTRIM(CAST(Aemails AS char)) + ') ' + shopname AS amountemailsFROM ( SELECT managername, shopname, (SELECT COUNT(*) AS msg FROM dbo.T_Customer_Mailbox AS A WHERE (datereply IS NULL) AND (status = 1) AND (ToUser = B.managername)) AS Aemails FROM dbo.T_SYS_ShopSystem AS B) AS TWHERE (Aemails > 0)ORDER BY shopname
Too old to Rock'n'Roll too young to die.