SELECT *
FROM
(
SELECT ROW_NUMBER() OVER (ORDER BY own) AS rown, block.*
FROM block
WHERE own > '9' AND type = 1
UNION
SELECT ROW_NUMBER() OVER (ORDER BY own) AS rown, block.*
FROM block
WHERE own > '9' AND type = 2
)
ORDER BY 2*rown+type
select "T2".* from "T2" inner join "T3" on "T3"."t2_id" = "T2"."id" AND "T3"."t1_id" " = ?
select "T2".* from "T2"
WHERE "T2".id in (SELECT "T3"."t2_id" FROM "T3" WHERE "T3".t1_id = ?)