.Which sentence is correct?
Why should have they done that?
Why should they have done that?
Why they should have done that? As a direct question it is not correct, but as an indirect question it is: Can you tell me why they should have done that?
and please tell me what is the rule to form a question in such a situation?