Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Mar 8, 2024
1 parent b6f90d6 commit af86849
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON (("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') GROUP BY "authors"."id" HAVING (((COUNT("books_any"."id") > 0)));
SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON (("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') GROUP BY "authors"."id" HAVING (((COUNT("books_any"."id") > 0)))) temp;
SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON (("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') GROUP BY "authors"."id" HAVING (((COUNT("books_any"."id") > 0)));
SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON (("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') GROUP BY "authors"."id" HAVING (((COUNT("books_any"."id") > 0)))) temp;
SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON ("authors"."id" = "books_any"."author_id") WHERE ((("books_any"."title" = 'Book 1')));
SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON ("authors"."id" = "books_any"."author_id") WHERE ((("books_any"."title" = 'Book 1')))) temp;
SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON ("authors"."id" = "books_any"."author_id") WHERE ((("books_any"."title" = 'Book 1')));
SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON ("authors"."id" = "books_any"."author_id") WHERE ((("books_any"."title" = 'Book 1')))) temp;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON ((("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') AND ("authors"."id" = "books_any"."author_id")) LEFT JOIN "public"."authors" AS "books_translator_any" ON (("books_any"."translator_id" = "books_translator_any"."id") AND "books_translator_any"."id" IS NULL) GROUP BY "authors"."id", "authors"."id" HAVING ((COUNT("books_any"."id") > 0) AND (COUNT("books_translator_any"."id") > 0));
SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON ((("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') AND ("authors"."id" = "books_any"."author_id")) LEFT JOIN "public"."authors" AS "books_translator_any" ON (("books_any"."translator_id" = "books_translator_any"."id") AND "books_translator_any"."id" IS NULL) GROUP BY "authors"."id", "authors"."id" HAVING ((COUNT("books_any"."id") > 0) AND (COUNT("books_translator_any"."id") > 0))) temp;
SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON ("authors"."id" = "books_any"."author_id") LEFT JOIN "public"."authors" AS "books_translator_any" ON ("books_any"."translator_id" = "books_translator_any"."id") WHERE (("books_any"."title" = 'Book 1') AND ("books_translator_any"."id" IS NULL));
SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON ("authors"."id" = "books_any"."author_id") LEFT JOIN "public"."authors" AS "books_translator_any" ON ("books_any"."translator_id" = "books_translator_any"."id") WHERE (("books_any"."title" = 'Book 1') AND ("books_translator_any"."id" IS NULL))) temp;
SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_count" ON (("authors"."id" = "books_count"."author_id") OR (("authors"."id" = "books_count"."author_id") AND "books_count"."price" < 100)) LEFT JOIN "public"."authors" AS "books_translator_count" ON (("books_count"."translator_id" = "books_translator_count"."id") AND "books_translator_count"."id" IS NOT NULL) GROUP BY "authors"."id", "authors"."id" HAVING ((COUNT("books_translator_count"."id") >= 1 AND COUNT("books_translator_count"."id") <= 1) OR (COUNT("books_count"."id") >= 1 AND COUNT("books_count"."id") <= 1));
SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_count" ON (("authors"."id" = "books_count"."author_id") OR (("authors"."id" = "books_count"."author_id") AND "books_count"."price" < 100)) LEFT JOIN "public"."authors" AS "books_translator_count" ON (("books_count"."translator_id" = "books_translator_count"."id") AND "books_translator_count"."id" IS NOT NULL) GROUP BY "authors"."id", "authors"."id" HAVING ((COUNT("books_translator_count"."id") >= 1 AND COUNT("books_translator_count"."id") <= 1) OR (COUNT("books_count"."id") >= 1 AND COUNT("books_count"."id") <= 1))) temp;
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any1" ON ((("authors"."id" = "books_any1"."author_id") AND "books_any1"."title" = 'Book 1') AND (("authors"."id" = "books_any1"."author_id") AND "books_any1"."price" = 50)) LEFT JOIN "books" AS "books_any2" ON ((("authors"."id" = "books_any2"."author_id") AND "books_any2"."title" = 'Book 2') AND (("authors"."id" = "books_any2"."author_id") AND "books_any2"."price" = 150)) GROUP BY "authors"."id", "authors"."id", "authors"."id", "authors"."id" HAVING (((COUNT("books_any1"."id") > 0) AND (COUNT("books_any1"."id") > 0)) AND ((COUNT("books_any2"."id") > 0) AND (COUNT("books_any2"."id") > 0)));
SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any1" ON ((("authors"."id" = "books_any1"."author_id") AND "books_any1"."title" = 'Book 1') AND (("authors"."id" = "books_any1"."author_id") AND "books_any1"."price" = 50)) LEFT JOIN "books" AS "books_any2" ON ((("authors"."id" = "books_any2"."author_id") AND "books_any2"."title" = 'Book 2') AND (("authors"."id" = "books_any2"."author_id") AND "books_any2"."price" = 150)) GROUP BY "authors"."id", "authors"."id", "authors"."id", "authors"."id" HAVING (((COUNT("books_any1"."id") > 0) AND (COUNT("books_any1"."id") > 0)) AND ((COUNT("books_any2"."id") > 0) AND (COUNT("books_any2"."id") > 0)))) temp;
SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any1" ON ("authors"."id" = "books_any1"."author_id") LEFT JOIN "books" AS "books_any2" ON ("authors"."id" = "books_any2"."author_id") WHERE ((("books_any1"."title" = 'Book 1') AND ("books_any1"."price" = 50)) AND (("books_any2"."title" = 'Book 2') AND ("books_any2"."price" = 150)));
SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any1" ON ("authors"."id" = "books_any1"."author_id") LEFT JOIN "books" AS "books_any2" ON ("authors"."id" = "books_any2"."author_id") WHERE ((("books_any1"."title" = 'Book 1') AND ("books_any1"."price" = 50)) AND (("books_any2"."title" = 'Book 2') AND ("books_any2"."price" = 150)))) temp;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" LEFT JOIN "tags" AS "tag" ON ("tag_followers"."tag_id" = "tag"."id") LEFT JOIN "books_x_tags" AS "tag_books_x_tags" ON ("tag"."id" = "tag_books_x_tags"."tag_id") LEFT JOIN "books" AS "tag_books_any" ON (("tag_books_x_tags"."book_id" = "tag_books_any"."id") AND "tag_books_any"."id" = 1) GROUP BY "tag_followers"."tag_id", "tag_followers"."author_id" HAVING ((COUNT("tag_books_any"."id") > 0));
SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" LEFT JOIN "tags" AS "tag" ON ("tag_followers"."tag_id" = "tag"."id") LEFT JOIN "books_x_tags" AS "tag_books_x_tags" ON ("tag"."id" = "tag_books_x_tags"."tag_id") LEFT JOIN "books" AS "tag_books_any" ON ("tag_books_x_tags"."book_id" = "tag_books_any"."id") WHERE (("tag_books_any"."id" = 1));

0 comments on commit af86849

Please sign in to comment.