I have two postgres queries that i execute using PHP and both of them result a Resource, is it开发者_开发知识库 possible to combine or concatenate these two resources?
If the queries produce the same resultset layout (same number of columns, all of same types), then you can concatenate the queries:
SELECT *
FROM mytable1
WHERE ...
UNION ALL
SELECT *
FROM mytable2
WHERE ...
If one or both queries give a single row of output but have different formats, then it may be more efficient to use cartesian product to retrieve the values in a single operation, e.g.
SELECT singlerow.*, multirow.*
FROM singlerow, multirow
WHERE singlerow.id=1
AND mutlrow.value>10;
C.
精彩评论