When I run this query:
select distinct idQuestion from Question
where parentid is null AND idQuestion not in (select distinct parentid from Question where parentid is not null)
order by idQuestion
The query never finishes after waiting several minutes. I've researched the issue and the conclusion is to use a LEFT JOIN instead of a sub-select. However, I'm not sure how to properly construct the query with these limitations.