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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:47:14+00:00 2026-06-02T06:47:14+00:00

I have 5 tables that I wish to get data from all linking to

  • 0

I have 5 tables that I wish to get data from all linking to a table called pubs.

special_offers has 3 records related to the pub
events has 4 records related to the pub

However I am only getting back the first event and special_offers. It does not seem to structure into a multi level array. I have tried join and inner joing, I cant see what might be wrong.

SELECT pubs.*, special_offers.*, `events`.*, vote.* 
  FROM pubs
    Inner Join `events` 
      ON pubs.id = `events`.pubID
    Inner Join special_offers 
      ON pubs.id = special_offers.pubID
    Inner Join vote 
      ON pubs.id = vote.pubID
  WHERE pubs.id = 48

Here is the output of print_r

Array (
 [0] => 48
 [id] => 1 Harveys
 [name] => Harveys
 [sun] => 10am-2.30am
 [31] => 1
 [32] => 4
 [special_dayID] => 4
 [33] => 48
 [pubID] => 48
 [34] => 2.50 Drinks
 [title] => Kodakid
 [35] => All drink 2.50 get them while there hot! or cold!
 [desc] => Kodakid are playing!
 [36] => 1
 [37] => 48
 [38] => 2012-04-30
 [date] => 2012-04-30
 [39] => Kodakid
 [40] => & others
 [subtitle] => & others
 [41] => Kodakid are playing!
 [42] => kodakid.jpg
 [img] => kodakid.jpg
 [43] => 1
 [44] => 48
 [45] => 3
 [price_range] => 3
 [46] => 5
 [atmosphere] => 5
 [47] => 2
 [food] => 2
 [48] => 4
 [service] => 4
 [49] => 3
 [value] => 3
 [50] => Waterford City
 [county] => Waterford City )

Thanks

  • 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-02T06:47:16+00:00Added an answer on June 2, 2026 at 6:47 am

    How are you doing the actual querying? MySQL doesn’t support nested arrays or rows. A result set consists of zero or more rows, and each row is one or more numbers, strings, dates, and so on.

    What you’re doing is asking for a result set consisting of all columns in all four tables. Because you’re using INNER join, you’re asking MySQL to only return rows that are present in all four tables. Thus an ID in pubs that doesn’t have an associated row in events will not be included in the result set, even if it does have rows in the other two.

    To do what you’re asking, you can either use separate queries (one for events, one for votes, etc…). You can also try using LEFT JOINs instead of INNER JOINs or sub-queries and aggregators like GROUP_CONCAT, but it really depends on what you plan on doing with the information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that I need to extract data from, and wish to
I have some tables that benefit from many-to-many tables. For example the team table.
In my database I have tables that define types for example Table: Publication Types
I have two tables that are joined together. A has many B Normally you
I have two tables that are related via a mapping table: keywords titles I
I have a table where I wish to update some of the rows. All
I have a table with various rows that display data, in each row I
I have this table named OrdersToCall Data types: All bigints, except for date which
I have some tables that I build as a part of my report rollup.
I have some tables that represent various types. They usually just consist of an

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.