Skip to content

Instantly share code, notes, and snippets.

@unlight
Last active April 14, 2020 20:00
Show Gist options
  • Select an option

  • Save unlight/9881ef802dc190e423ebbfc2283f9a2b to your computer and use it in GitHub Desktop.

Select an option

Save unlight/9881ef802dc190e423ebbfc2283f9a2b to your computer and use it in GitHub Desktop.
fee articles sql (multiple articles created by followed users, ordered by most recent first.)
// multiple articles created by followed users, ordered by most recent first.
SELECT `Article`.`id`,
`Article`.`slug`,
`Article`.`title`,
`Article`.`description`,
`Article`.`body`,
`Article`.`createdAt`,
`Article`.`updatedAt`,
`Article`.`favoritesCount`,
`Article`.`authorId`
FROM `Article`
WHERE (`Article`.`id`) IN
(SELECT `t0`.`id`
FROM `Article` AS `t0`
INNER JOIN `User` AS `j0` ON (`j0`.`id`) = (`t0`.`authorId`)
WHERE (`j0`.`id`) IN
(SELECT `t1`.`A`
FROM `_UserFollows` AS `t1`
INNER JOIN `User` AS `j1` ON (`j1`.`id`) = (`t1`.`B`)
WHERE `j1`.`id` = 'ck90ahn3v0001dcwzq3g3f2re'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment