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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:02:16+00:00 2026-06-13T14:02:16+00:00

I have a table with data as follows, detectDate |isp |infection | count ————————————–

  • 0

I have a table with data as follows,

detectDate      |isp    |infection  | count
--------------------------------------
2012-10-02 01:00|aaaa   |malware    |3
2012-10-02 01:30|bbbb   |malware    |2
2012-10-02 01:33|bbbb   |spy-eye    |2
2012-10-02 01:45|aaaa   |DDos       |1
2012-10-03 01:50|cccc   |malware    |2
2012-10-03 02:00|dddd   |TDSS       |2
2012-10-03 04:50|dddd   |TDSS       |3

I need to get an out put like this, grouped by date and infection like so,

detectDate      |infection  | count
--------------------------------------
2012-10-02      |malware    |5
2012-10-02      |spy-eye    |2
2012-10-02      |DDos       |1
2012-10-03      |malware    |2
2012-10-03      |TDSS       |5

I know how to use group in general but not his far 🙁 can you please help me I need to group by date and infection and get the total of the count field as shown.

  • 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-13T14:02:18+00:00Added an answer on June 13, 2026 at 2:02 pm

    Use SUM function to sum count column and use DATE_FORMAT function to group by only date.

    SELECT DATE_FORMAT(detectDate, '%Y-%m-%d') AS detectDate
          ,infection 
          ,SUM(`COUNT`) as `count`
    FROM myTable
    GROUP BY DATE_FORMAT(detectDate, '%Y-%m-%d'), infection
    

    See this SQLFiddle

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

Sidebar

Related Questions

I have table of data that is sorted as follows: Item | Sample |
I have a table say, ITEM, in MySQL that stores data as follows: ID
I have a table table_a with a column containing data as follows: .aaa01932 .asd02343
I have a MySQL table with fields and data such as follows; PartNumber Priority
My scenario is as follows: I have a table of data (handful of fields,
I have a data table as follows ID Key Value -------------------------- 1 F1 2
I have a table that stores the data as follows: ID ListId ModuleId RecordId
I have a large table of data roughly laid out as follows. As requested
I have a table of data as follows id status conversation_id message_id date_created 1
I have a data table as follows FName SName DOB PCode Addr1 ==== ====

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.