Sort by node or comment We have a Question and Answer setup on Drupal. Question is a node. The answer is a comment. 

What we are trying to do is to order Questions by either the latest asked question or by the latest commented question. 

So when a new comment it posted, that questions moves on top. I can do it for Question or comments. But can't combine the two together.

Is there any way to achieve this?
If you were building the SQL directly, you could do it in the ORDER BY clause with the CASE WHEN syntax where you do something like:

CASE WHEN comment_table.timestamp &gt; node_table.timestamp then comment_table.timestamp else node_table.timestamp

Since there is no default Views core plugin for CASE WHEN sorting, you can either build a Views sort plugin that implements the syntax or use existing plugins that allow custom SQL with a notable security caveat that comes with storing code in your configuration.