Use join instead of subquery

This commit is contained in:
Nils Werner 2014-11-15 16:10:44 +01:00
parent 331af08128
commit ceae6d5bfe

View file

@ -79,13 +79,12 @@ LIMIT 1;
// SQL statement to retrieve a list of Repos // SQL statement to retrieve a list of Repos
// with permissions for the given User ID. // with permissions for the given User ID.
const repoListQuery = ` const repoListQuery = `
SELECT * SELECT r.*
FROM repos FROM
WHERE repo_id IN ( repos r
SELECT repo_id ,perms p
FROM perms WHERE r.repo_id = p.repo_id
WHERE user_id = ? AND p.user_id = ?
);
` `
// SQL statement to delete a User by ID. // SQL statement to delete a User by ID.