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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:17:00+00:00 2026-06-11T23:17:00+00:00

unexperienced mysql user here :) I have 2 tables One holds a list of

  • 0

unexperienced mysql user here 🙂

I have 2 tables

One holds a list of events created by users. It also has a description of the event.

The other table holds the date(s) for the event. It also has the unique id for the event. One event can have multiple dates associated with it.

My problem:

I wish to return a list with the events and the description. Right now I use a for each loop for this.

Example:

[loop]
    $list .= '<tr><td>$date</td><td>$description</td><tr>';
[/loop]

return $list;

Now I need to show events with the same date as one event but combining the descriptions

Example:

$list .= '
    <tr>
        <td>two-events-with-same-dates-here-but-shown-as-one</td>
        <td>$description 1<br />$description 2</td>
    </tr>
    ';
return $list;

So my idea was to group by date and run a loop for each group with a new query and combine the descriptions into one description.

Running new queries in loops sound wrong and inefficient to me a I figured mysql has some smart build-in functions for something like this.

Ideas?

  • 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-11T23:17:01+00:00Added an answer on June 11, 2026 at 11:17 pm

    what about sorting the result by date, and then add < br/ > in php until the date has changed?

    another solution is to use group_concat. example:

    select date, group_concat(description SEPARATOR '<br/>')
    from events
    group by date
    

    this will procuce

    '2012-01-01' | 'description1<br/> description2'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have program, that has structure defined like this: struct foo { int magic;
I am fairly unexperienced with the behavior of grep. I have a bunch of
I have a filemanager application that allows users to upload files to the server
I have an application with an entity of class A. A has a field
I have a MySQL(innodb) table 'items' with the following characteristics Large number of rows,
I am very inexperienced using multi-threading techniques, but here is what I have tried:
I'm dabbling in C#,and I'm rather inexperienced with it. I have a button with
I am designing the user interface of a web application but I am inexperienced
I have a stubborn (or maybe inexperienced would be a nicer word) Windows host
I'm pretty unexperienced with Action Script but searched the forums extensively to try and

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.