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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:05:49+00:00 2026-06-12T15:05:49+00:00

I am looking for a way to group duplicate column data. I have a

  • 0

I am looking for a way to group duplicate column data.
I have a table with data like:

-------------------------------------------
ID  | locationId | day | open     | close
-------------------------------------------
1   | 1213       | Wed | 10:00 am | 4:30 pm
-------------------------------------------
2   | 1213       | Thr | 10:00 am | 4:30 pm
-------------------------------------------
3   | 1213       | Fri | 10:00 am | 4:30 pm
-------------------------------------------
4   | 1213       | Sat | 10:00 am | 5:30 pm
-------------------------------------------

I am using group_concat to return the information for locationId 1213 as

Wed: 10:00 am-04:30 pm,Thu: 10:00 am-04:30 pm,Fri: 10:00 am-04:30 pm,Sat: 10:00 am-05:30 pm

Is there a way to use group_concat or another function/query to group the duplicate open and close times and return the data similar to the following?

Wed,Thr,Fri: 10:00 am-04:30 pm,Sat: 10:00 am-05:30 pm

or even

Wed-Fri: 10:00 am-04:30 pm,Sat: 10:00 am-05:30 pm

Below is the SQL code that I am using:

SELECT appdata.nameShort, 
group_concat(distinct concat(appdatahours.`day`,": ", appdatahours.open, "-", 
appdatahours.close)) as hours
FROM appdata
LEFT JOIN appdatalocations on appdatalocations.listingId = appdata.id
LEFT JOIN appdatahours on appdatahours.locationId = appdatalocations.id
GROUP BY appdata.id
  • 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-12T15:05:51+00:00Added an answer on June 12, 2026 at 3:05 pm

    try this (uses a derived table):

    select locationId, group_concat(day_group) from
    (
        SELECT
        locationID, concat(group_concat(`day`),": ", open, "-", close) as day_group
        FROM tableB
        GROUP BY locationID, open, close
    ) dayGroup;
    

    sqlfiddle here: http://sqlfiddle.com/#!2/c19c5/1/0

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

Sidebar

Related Questions

I'm looking for a way to group some ui elements together just like the
I'm looking for a way to group more than one column in mysql. The
I'm looking for way to create list view as like in IOS with pinned
Looking for a way to group in sets of n elements with LINQ. I.e:
I'm looking the best way to create a group of four buttons. Each button
I'm looking for a way how to programmatically create a local user group. I
i`m looking for way to position expandableListView group on top, when expanded. I tried
I'm looking for a way to make a GROUP BY operation in a query
I'm looking for a way to handle the following scenario. I have a database
Edit: Looking for a way to close the dropdown when anything but the button

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.