smr/src/sql/select_author_of_post.sql

14 lines
233 B
SQL

/*
Get the author of a story, used to check when editing that the
author really owns the story they're trying to edit
*/
SELECT
authors.id,
authors.name
FROM
authors,
posts
WHERE
posts.authorid = authors.id AND
posts.id = :id;