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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:11:26+00:00 2026-06-13T20:11:26+00:00

I have a table with 3 fields. This table keeps record of call duration

  • 0

I have a table with 3 fields. This table keeps record of call duration for each day to the relevant country for last 30 days.

C_Date      Country         C_Time  
2012-10-01  India           1316
2012-10-01  USA             12  
2012-10-01  UK              132     
2012-10-01  Kuwait          134     
2012-10-02  UK              135     
2012-10-02  USA             136     
2012-10-02  Singapore       137     

I need to generate a table and a line graph using this records and I tried to write the MySQL query. Basically I need to draw this only for selected countries.
Say I want India, USA and UK ; then I need to pull a record set like this:

C_Date     | Calling_Time
-----------+----------------------------------
2012-10-01 | 1316,12,132
2012-10-02 | 0,136,135
2012-10-03 | ...
...        | ...

This is my Query:

SELECT C_Date, GROUP_CONCAT(C_Time
ORDER BY Country
SEPARATOR ',') as Calling_Time
FROM Call_Table t
WHERE Country
IN ('India', 'USA', 'UK')
GROUP BY C_Date
ORDER BY  C_Date

The result was much closer, but it had ignored the empty results.

C_Date     | Calling_Time
-----------+----------------------------------
2012-10-01 | 1316,12,132
2012-10-02 | 136,135   (expected 0,136,135)

Can I change my query to get the Calling_Time like 0,136,135 OR ,136,135 OR null,136,135 ?(with unique numbers of segments to represent each country )

Thanks in advance!

  • 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-13T20:11:27+00:00Added an answer on June 13, 2026 at 8:11 pm

    Try this query –

    SELECT
      C_Date,
      CONCAT(MAX(IF(country = 'India', C_Time, 0)), ',',
             MAX(IF(country = 'USA', C_Time, 0)), ',',
             MAX(IF(country = 'UK', C_Time, 0))) Calling_Time
      FROM call_table
      GROUP BY C_Date
    
    +------------+--------------+
    | C_Date     | Calling_Time |
    +------------+--------------+
    | 2012-10-01 | 1316,12,132  |
    | 2012-10-02 | 0,136,135    |
    +------------+--------------+
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my Table structure like this :: ATT_Table : Fields - Act_ID, Assigned_To_ID,
I have a table of 2 fields. Word and timestamp. Then i have this
i have this code, which helps me to retrieve all table fields and associate
I have a table like this, with three fields: User | Question# | Answer
I have a table called invoices with 3 fields (for the purposes of this
I have a table with two decimal(18,0) fields. I am inserting into this table,
I have an HTML table in my jsp page. This conains text fields and
I have a table where a plugin keeps all form submissions, in this table
I have this table (TableA): ( [FieldA] [int] NOT NULL, [FieldB] [int] NOT NULL,
I have this Points table: =========================================== FIELD : TYPE =========================================== id int(11) user_id int(11)

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.