Is it possible to somehow ignore duplicate values in recursion (CTE), otherwise it just loops?
There is a situation that during recursion there will be a looping:
For example:
id from_user to_user message 1 1 3 some msg 2 3 2 some msg 3 2 4 some msg 4 4 1 some msg I want to go through recursion to take all 4 records
id from_user to_user message 1 1 3 some msg 2 3 2 some msg 3 2 4 some msg 4 4 1 some msg but that the record with id 1 (repetitive) does not enter recursion more than once, otherwise an infinite loop is obtained (up to OPTION (MAXRECURSION 100) times) ...
I need to take these records hierarchically ...