Original query:

SELECT "main"."ID" "ID", "main"."name" "name", "main"."activity" "activity", "main"."type" "type", "main"."currency" "currency", "main"."datefrom" "datefrom", "main"."dateto" "dateto", "main"."prices" "prices", (COALESCE("accounts"."accounts", 0)) "accounts", "main"."applytoall" "applytoall", (SELECT "ID" FROM "follows" WHERE ("creator" = 1005 AND "entity" = 'pricelists' AND "index" = "main"."ID")) "follow"
FROM (SELECT "main"."ID" "ID", "main"."name" "name", "main"."activity" "activity", "main"."type" "type", "main"."currency" "currency", "main"."datefrom" "datefrom", "main"."dateto" "dateto", (COALESCE("prices"."prices", 0)) "prices", "main"."applytoall" "applytoall", "accounts"."ID" "__join_accounts"
FROM "pricelists" "main"
LEFT JOIN (SELECT "pricelist" "ID", (COUNT(*)) "prices"
FROM "prices" "pri"
WHERE "item" IN (SELECT "ID" FROM "items" WHERE "visibility" <> 2)
GROUP BY "pricelist") "prices" ON "prices"."ID" = "main"."ID"
WHERE ((("main"."ownergroup" IN (1, 2, 11, 12) OR "main"."ownergroup" IS NULL) AND "main"."activity" <> 2))
ORDER BY (COALESCE("prices"."prices", 0)), "main"."name", "main"."ID"
LIMIT 100) "main"
LEFT JOIN (SELECT "pricelist" "ID", (COUNT(*)) "accounts"
FROM "pricelists2accounts" "pri"
WHERE "account" IN (SELECT "ID" FROM "accounts" WHERE "visibility" <> 2)
GROUP BY "pricelist") "accounts" ON "accounts"."ID" = "__join_accounts"
ORDER BY "main"."prices", "main"."name", "main"."ID"

Prettified:

SELECT
  "main"."ID" AS ID,
  "main"."name" AS name,
  "main"."activity" AS activity,
  "main"."type" AS type,
  "main"."currency" AS currency,
  "main"."datefrom" AS datefrom,
  "main"."dateto" AS dateto,
  "main"."prices" AS prices,
  COALESCE("accounts"."accounts", 0) AS accounts,
  "main"."applytoall" AS applytoall,
  (SELECT "ID" FROM "follows" WHERE "creator" = 1005 AND "entity" = 'pricelists' AND "index" = "main"."ID") AS follow
FROM
  (
    SELECT
      "main"."ID" AS ID,
      "main"."name" AS name,
      "main"."activity" AS activity,
      "main"."type" AS type,
      "main"."currency" AS currency,
      "main"."datefrom" AS datefrom,
      "main"."dateto" AS dateto,
      COALESCE("prices"."prices", 0) AS prices,
      "main"."applytoall" AS applytoall,
      "accounts"."ID" AS __join_accounts
    FROM
      "pricelists" main
      LEFT JOIN (
        SELECT
          "pricelist" AS ID,
          count(*) AS prices
        FROM
          "prices" pri
        WHERE
          "item" IN (SELECT "ID" FROM "items" WHERE "visibility" <> 2)
        GROUP BY
          "pricelist"
      ) prices ON ("prices"."ID" = "main"."ID")
    WHERE
      (
        "main"."ownergroup" IN (1, 2, 11, 12) OR
        "main"."ownergroup" IS NULL
      ) AND
      "main"."activity" <> 2
    ORDER BY
      COALESCE("prices"."prices", 0),
      "main"."name",
      "main"."ID"
    LIMIT
      100
  ) main
  LEFT JOIN (
    SELECT
      "pricelist" AS ID,
      count(*) AS accounts
    FROM
      "pricelists2accounts" pri
    WHERE
      "account" IN (SELECT "ID" FROM "accounts" WHERE "visibility" <> 2)
    GROUP BY
      "pricelist"
  ) accounts ON ("accounts"."ID" = "__join_accounts")
ORDER BY
  "main"."prices",
  "main"."name",
  "main"."ID"