简体   繁体   English

有什么选择可以在zend中容纳两个sql结果吗?

[英]Is there any option to concatente two sql results in zend?

I having 2 database, both having same set of tables. 我有2个数据库,都具有相同的表集。 I need latest three records from both db tables. 我需要两个数据库表中的最新三个记录。 Is it possible to concatenate 2 sql records in zend. 是否可以在zend中串联2条sql记录。 because of object array concatenate is not working 由于对象数组连接不起作用

I tried 'union' because of limit problem(we can give only one limit at the end of query), that not possible 由于限制问题,我尝试了“联合”(在查询结束时我们只能给出一个限制),这是不可能的

You can use individual LIMIT clauses for each sub-query in the UNION . 您可以对UNION中的每个子查询使用单独的LIMIT子句

From the manual: 从手册中:

(SELECT a FROM t1 WHERE a=10 AND B=1 ORDER BY a LIMIT 3)
UNION
(SELECT a FROM t2 WHERE a=11 AND B=2 ORDER BY a LIMIT 3);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM