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

  • Home
  • SEARCH
  • 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 257511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:06:10+00:00 2026-05-11T22:06:10+00:00

In the following code: $selectColumns= array(‘user_id.user_email’, // inner join the data from user_id and

  • 0

In the following code:


$selectColumns= array('user_id.user_email', // inner join the data from user_id and user_details
                            'user_details.first_name', 
                            'user_details.last_name');
        $result = $handle->select()->from('user_id', $selectColumns)
                                   ->where('user_id.uid=?', $uid)
                                   ->join('user_details', 'user_id.uid = user_details.uid')
                                   ->query(ZEND_DB::FETCH_OBJ);

Zend selects all the columns in the table, not just the requested ones.

How can I select only some?

  • 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-05-11T22:06:11+00:00Added an answer on May 11, 2026 at 10:06 pm

    The problem is in your join() method call:

    ->join('user_details', 'user_id.uid = user_details.uid')
    

    The optional third argument is columns from this table. If the argument is absent, it defaults to user_details.*.

    Note that you added qualified columns from both tables in the from() table, but this has no effect on the default of user_details.*. Sorry, but Zend_Db_Select just isn’t smart enough to keep track of all that.

    You can make the join() call add no columns by passing an empty array:

    ->join('user_details', 'user_id.uid = user_details.uid', array())
    

    The qualified columns you added in the from() call should still be there. To verify this yourself, print the SQL:

    print $result . "\n"; // calls __toString() method on Zend_Db_Select object
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 217k
  • Answers 217k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your question is a bit confusing because you don't need… May 12, 2026 at 11:24 pm
  • Editorial Team
    Editorial Team added an answer Check out the MySQL Connector for .NET below is an… May 12, 2026 at 11:24 pm
  • Editorial Team
    Editorial Team added an answer The Application_Start and Application_End methods are special methods that do… May 12, 2026 at 11:24 pm

Related Questions

In the following code: $selectColumns= array('user_id.user_email', // inner join the data from user_id and
I have the following code: $selectColumns= array('user_id.user_email', 'user_details.first_name', 'user_details.last_name', 'user_details.zip', 'user_details.store_id'); $result = $handle->select()->from('user_id')
In the following code, both amp_swap() and star_swap() seems to be doing the same
In the following code, used to get a list of products in a particular
In the following code I loop through a map and test if an element

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.