Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7794571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:48:50+00:00 2026-06-01T22:48:50+00:00

I want to execute below query in zend framework. can anyone tell me how

  • 0

I want to execute below query in zend framework. can anyone tell me how can I do that?

(SELECT `msg`.`message_sender_id`, `msg`.`message_receiver_id`, `msg`.`message_content`, `msg`.`message_sent_on`, `usr`.`user_name` AS `sender_name`
 FROM `sc_message` AS `msg` INNER JOIN `sc_user` AS `usr` ON `msg`.`message_sender_id` = `usr`.`user_id` 
 WHERE `msg`.`message_id` = 3 ORDER BY `msg`.`message_sent_on`)

UNION 

(SELECT `msg_slv`.`message_slave_sender_id`, `msg_slv`.`message_slave_receiver_id`, `msg_slv`.`message_slave_content`, `msg_slv`.`message_slave_sent_on`, `usr`.`user_name` AS `sender_name`
 FROM `sc_message_slave` AS `msg_slv` INNER JOIN `sc_user` AS `usr` ON `msg_slv`.`message_slave_sender_id` = `usr`.`user_id`
 WHERE `msg_slv`.`message_id` = 3 ORDER BY `msg_slv`.`message_slave_sent_on`)

I have written below code

    $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'))
                     ->joinInner(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);

    $this->_name = "sc_message_slave";
    $this->_primary = "message_slave_id";
    $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'))
                     ->joinInner(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);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:48:51+00:00Added an answer on June 1, 2026 at 10:48 pm

    Assuming you’re working from some Zend_Db_Table method

    //your code...
    
    $unionSelect = $this->getAdapter()->select()->union(array($Query_1, $Query_2));
    //no you can execute it
    $rows = $this->getAdapter()->fetchAll($unionSelect);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to execute a SQL query in mysql something like the below: SELECT
How can I execute the results of my select query. The query below gives
Suppose that I have a database query which looks like below - select name,
I am trying to execute mysql select insert query as below. INSERT INTO ACCOUNTS.TABLE1
I want to execute a php-script from php that will use different constants and
I want to execute some mysql statements that are stored in a text file
I want to execute a query in which I rename one of the columns
I want to execute a semi-complex query in Django. For example I want something
I am writing a script using DBI to execute a select query to an
I'm working on a query for SQL Server and I'm wondering if anyone can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.