I want to do a smart count operation, so if the data in the columns is the same, then it will be considered as 1.
My table:
dbo.Messages
(
FromUserId INT,
ToUserId INT
)
Data:
INSERT dbo.Messages VALUES(1, 5), (2, 20), (5, 1), (1, 5);
The count should return 2, because (1,5) and (5,1) are the same in my algorithm.
How can I write it in SQL Server TSQL?
Thanks in advance.
source
share