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

  • Home
  • SEARCH
  • 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 8639217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:56:50+00:00 2026-06-12T10:56:50+00:00

I have tables(mysql 5.5 INNODB):sample small data + cut not relevant columns for questions

  • 0

I have tables(mysql 5.5 INNODB):sample small data + cut not relevant columns for questions – real data huge(more then 10,000,000 rows in meeting table)

INPUT:

day:

day_id(primary key)|sunday|monday|tuesday|wensday|thursday|friday|saturday
---------------------------------------------------------------------------
60                 |1     |1     |1      |1      |1       |1    |1
74                 |0     |1     |0      |0      |0       |0     |0
98                 |0     |0     |0      |0      |0       |0     |0
..etc......................................................................

meeting:

day_id(foreign key)|time    |type
----------------------------------
60                 |20:09:00|1
98                 |07:00:00|1
74                 |22:01:00|4
98                 |10:00:00|1
60                 |23:09:00|2
98                 |06:00:00|2
74                 |21:04:00|6
98                 |08:00:00|6
.....etc.....................

OUTPUT:

sunday_times          |monday_times                           |....etc
-------------------------------------------------------------------------------------------------
20:09:00,etc...       | 20:09:00,etc..   |
................etc..............................................................................

I think something like that (but I am new with sql soo i don’t know if it good or legal)

 SELECT 
   GROUP_CONCAT(time where day.sunday=1 ORDER BY time) as sunday_times, 
   GROUP_CONCAT(time where day.monday=1 ORDER BY time) as monday_times,  
   etc..
 FROM day
 JOIN meeting ON meeting.day_id=day.day_id
 GROUP BY type
  • 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-12T10:56:51+00:00Added an answer on June 12, 2026 at 10:56 am

    Your syntax was close, you need to use a CASE statement inside of the GROUP_CONCAT():

    SELECT 
       GROUP_CONCAT(case when day.sunday=1 then time end order by time) as sunday_times, 
       GROUP_CONCAT(case when day.monday=1 then time end order by time) as monday_times
     FROM day
     JOIN meeting ON meeting.day_id=day.day_id
    GROUP BY type
    

    See SQL Fiddle With Demo

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

Sidebar

Related Questions

I have a MySQL InnoDB table with 238 columns. 56 of them are TEXT
I have 5 MySQL InnoDB tables: Test,InputInvoice,InputLine,OutputInvoice,OutputLine and each is mapped and functioning in
I have two tables in mysql, both are type InnoDB and there is an
Here's some background info. I have three MySQL tables (all InnoDB). The first table
I have three MySQL InnoDB tables: Debtors Companies Private individuals Now I would like
I have a MySql Db with innoDB tables. I need to alter a couple
I am having issues with an InnoDB mysql database. E.g., I have two tables,
I have a mySQl innodb database which has a couple of tables which store
I am experimenting with MySQL enum data type. I have a table 15 columns
I have MySQL InnoDB table utf-8 encoded. This table has only id and name

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.