There are 3 tables: notes, users and comments. Links:
notes.author_id - users.id
comment.note_id - notes.id
When selecting notes from notes, you need to get the name of the author from users (you figure it out) and count the number of comments to the note. How to do it?
SELECT notes.id, notes.title, notes.content users.username - COUNT (comments.id) AS comments_count FROM notes INNER JOIN users ON (notes.author_id = users.id) - ??? ORDER BY datetime Desc