Table : sc_message
______________________________________________________________________
|message_id | message_sender_id | message_receiver_id | message_content|
------------------------------------------------------------------------
Table : sc_user
_____________________
| user_id | user_name |
-----------------------
Table : sc_message_slave
| message_slave_id | message_slave_sender_id | message_slave_receiver_id | message_slave_content | message_slave_sent_on |
$Query_1 = $this ->select()
->from(array('msg' => 'sc_message'), array('msg.message_sender_id', 'msg.message_receiver_id', 'msg.message_content', 'msg.message_sent_on'))
->join(array('usr' => 'sc_user'), 'msg.message_sender_id = usr.user_id', array('usr.user_name as sender_name'))
->where('msg.message_id = ?',$message_id)
->setIntegrityCheck(false);
$Query_2 = $this ->select()
->from(array('msg_slv' => 'sc_message_slave'), array('msg_slv.message_slave_sender_id', 'msg_slv.message_slave_receiver_id','msg_slv.message_slave_content', 'msg_slv.message_slave_sent_on'))
->join(array('usr' => 'sc_user'), 'msg_slv.message_slave_sender_id = usr.user_id', array('usr.user_name as sender_name'))
->where('msg_slv.message_id = ?',$message_id)
->setIntegrityCheck(false);
$select = $this ->select()
->union(array($Query_1, $Query_2))
->order('msg.message_sent_on')
->setIntegrityCheck(false);
它给了我这样的警告,并且执行在那里停止..
Warning: Invalid use of table with UNION in E:\wamp\www\social_site\library\Zend\Db\Select.php on line 1222
你能告诉我查询有什么问题吗?