Can anyone tell me what is wrong with my query?

Screen Link:
https://app.dataquest.io/m/190/building-and-organizing-complex-queries/3/the-with-clause

My Code:

SELECT
         p.playlist_id playlist_id,
         p.name playlist_name,
         COUNT(t.name) track_name,
         SUM(t.milliseconds / 1000.0) length_seconds
     FROM track t
     LEFT JOIN playlist_track pt ON pt.track_id= t.track_id
     LEFT JOIN playlist p ON p.playlist_id = p.playlist_id
     GROUP BY 1, 2
     ORDER BY 1;

What I expected to happen:

Are you sure you ran the right code for the 2nd image?

I ran the code you shared, and it produces the output you expect. The 2nd image has a column name number_of_tracks which can’t happen because that’s not part of the code you shared.

My bad. Actually, the expected and the actual happened are interchanged.

Any particular reason you are not using the WITH clause to create a subquery as the instructions ask?

You can edit your original post.

Nothing as such, but the question arises in my mind, why my query gives a different result if there is nothing wrong as per the question requirement other than the WITH clause.