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", (SELECT (COUNT(*))
FROM "pricelists2accounts" "pri"
WHERE ("account" IN (SELECT "ID" FROM "accounts" WHERE "visibility" <> 2) AND "pricelist" = "main"."ID")) "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"
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"
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,
  (SELECT count(*) FROM "pricelists2accounts" pri WHERE "account" IN (SELECT "ID" FROM "accounts" WHERE "visibility" <> 2) AND "pricelist" = "main"."ID") 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
    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
ORDER BY
  "main"."prices",
  "main"."name",
  "main"."ID"