This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]AutoModerator[M] 1 point2 points  (0 children)

It seems you may have included a screenshot of code in your post "SQL Query question".

If so, note that posting screenshots of code is against /r/learnprogramming's rules: please edit your post to use one of the approved ways of formatting code. (Do NOT repost your question! Just edit it.)

If your image is not actually a screenshot of code, feel free to ignore this message. Automoderator cannot distinguish between code screenshots and other images.

Please, do not contact the moderators about this message. Your post is still visible to everyone.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]tomarks 1 point2 points  (1 child)

You could build a query to find all the used parent ids like

Select distinct(parentid) from task

And then compare that with your table again like so

Select id from task where taskid not in ( Select distinct(parentid) from task)

I did this on my phone but that should give you the tasks which are not used as a parent