Skip to content

Instantly share code, notes, and snippets.

@renganatha10
Created October 31, 2019 06:15
Show Gist options
  • Save renganatha10/ef80c65af03f8e610c1d6706a43df0e8 to your computer and use it in GitHub Desktop.
Save renganatha10/ef80c65af03f8e610c1d6706a43df0e8 to your computer and use it in GitHub Desktop.
POSTGRES.sql
SELECT (SELECT pl.id, pl."postId" FROM "PostLikes" as pl where "Posts".id = pl."postId" ) as postCount, "Posts"."id" as "postId" FROM "Posts"
INNER JOIN "Users" as "user" ON "Posts"."userId" = "user"."id"
WHERE "Posts"."userId" = '40f7198d-6851-4e19-94fb-df0094b84bb6'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment