r/SQL • • 14h ago

PostgreSQL Where did I go wrong?

Thumbnail
gallery
8 Upvotes

For context, photos 1-2 show the original prompt + my answer. Photo 3 shows the solution. The output is somewhat similar to the correct answer, but not quite the same.

When I move the "status = 'Completed'" either to the "WHERE" section or to the JOIN section as "AND status = 'Completed'" it solves the problem, but not sure exactly why.