我有一个这样的查询:
SELECT recipientid AS ID,
COUNT(*) AS Recieved FROM Inbox
GROUP BY recipientid
UNION
SELECT SenderId,
COUNT(*) AS [Sent] FROM Inbox
GROUP BY SenderId
输出:
RecipientID Recieved
001 3
001 4
002 4
002 2
003 18
003 55
我如何重写是这样的,它显示如下:
RecipientID Recieved Sent
001 3 4
002 4 2
003 18 55
谢谢。