Hello,
I "have" this two tables:
Table Cat:
id|A|B
--+-+-
1|3|5
2|5|8
3|6|9
Table Pr:
id|Catid|
--+-
1|3
2|2
3|1
I need replace "Catid" column for corresponding values A and B (Table
Cat) in Table Pr.
Virtual table like this:
Table Pr:
id|Catid|A|B
--+-+-+
1|3|6|9
2|2|5|8
3|1|3|5
Something like this, but that works,...
SELECT * FROM pr WHERE pr.a > 1 AND pr.b < 10;
With subqueries is too slow:
SELECT * FROM "Pr" AS p, (SELECT "id" AS cid FROM
"Cat" WHERE "lft" > 1 AND "rgt" < 10) AS c WHERE
p."Cat"=c."cid" AND (...)) ORDER BY "Catid" ASC OFFSET 0 LIMIT 40
Any suggestion?
|