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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:17:34+00:00 2026-06-17T02:17:34+00:00

I have two tables, one stores events for a user and the other stores

  • 0

I have two tables, one stores events for a user and the other stores the photos for each event. The layout is as follows:

event (event_id, 
       event_title, 
       event_description, 
       event_date, 
       event_time, 
       event_city, 
       event_state, 
       event_user)

photo (photo_id, 
       photo_photo, 
       photo_thumbnail, 
       photo_caption, 
       photo_event)

On my event page I want to display all of my events in a grid. Now, the catch is that I am using a live album preview with jQuery (http://tutorialzine.com/2012/12/album-photo-previews-jquery/) so I need all of the thumbnails for each event to be returned as well. Can I do this with a single query?

My current query is

"SELECT event.*, photo_thumbnail FROM event 
   LEFT JOIN photo ON event_id = photo_event 
   WHERE event_user = ?;" 

but it is giving me the event information for each photo returned which is unnecessary. I just need the event information once along with every photo for each event. Any help is appreciated.

  • 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-17T02:17:35+00:00Added an answer on June 17, 2026 at 2:17 am

    I would use something like:

    SELECT event.*, GROUP_CONCAT(photo_thumbnail) as thumbnails
    FROM event 
    LEFT JOIN photo ON event_id = photo_event 
    WHERE event_user = ?
    GROUP BY event.event_id;
    

    This will give a thumbnails column in your results which will be a comma separated list of the thumbnails.

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

Sidebar

Related Questions

I have two tables, one stores user sessions and the other stores shopping cart
I have two tables, one that stores user earnings and another that stores the
I have two tables. One with information about properties. The other stores 3 images
I have two tables: one that stores blogs and the other that stores images
I have two tables one is table Profile and other is table Profile_location (stores
I have two tables one called fs_note the other called dumy_fs_note I created after
I have two tables : one table it matchs and the other is teams.
I have two tables. One user table and one table in which results are
I have two tables, one that has 450 rows, the other is a Sort
I have two tables user and email. One user can have multiple emails so

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.