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 7900207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:54:42+00:00 2026-06-03T08:54:42+00:00

Im looking for a general solution for such queries: SELECT * FROM A LEFT

  • 0

Im looking for a general solution for such queries:

SELECT * FROM A
LEFT JOIN B on A.ID = B.FK_ID
SELECT * FROM A

LEFT JOIN B on A.ID = B.FK_ID
LEFT JOIN C on B.ID = C.FK_ID

to have it in an array, so joined records would be in a nested arrays. It’s very complicated isn’t it? All I have is the query and fetched all records

EDIT:

it normally would return

A.col1  A.col2  A.col3  B.col1  B.col2  B.col3

if A has 4 rows and 2 records of B connects to A, A will have 5 lines. Instead, I want this:

A.col1  A.col2  A.col3  B (array)
  • 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-03T08:54:43+00:00Added an answer on June 3, 2026 at 8:54 am

    When you construct the source array slightly different you can use this function.

    It’s a duplicate (http://stackoverflow.com/questions/8431463/more-efficient-hierarchy-system/8431551) (parent_id,id,title):

    $q = mysql_query("SELECT id, parent_id, name FROM categories");
    while ($r = mysql_fetch_row($q)) {
      $names[$r[0]] = $r[2];
      $children[$r[0]][] = $r[1];
     }
    
    function render_select($root=0, $level=-1) {
      global $names, $children;
      if ($root != 0)
        echo '<option>' . strrep(' ', $level) . $names[$root] . '</option>';
      foreach ($children[$root] as $child)
        render_select($child, $level+1);
    }
    
    echo '<select>';
    render_select();
    echo '</select>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a general and complete solution to this common problem! I
Looking for a general case solution to determine if any jquery dialog (there are
I'm looking for a general solution for upgrading database schema with ORM tools, like
I am looking for a better solution than what we currently have to deal
I would like to have an easy way to run queries like the following
Here's a very specific question, but I'm looking for a slightly more general solution
I'm looking for a general strategy/advice on how to handle invalid UTF-8 input from
I'm looking for a general solution for updating one large data frame with the
I've found a similar question here , but I'm looking for more general solutions.
Looking at the general trend of comments in my question about Building an Aircraft

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.