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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:52:26+00:00 2026-06-10T19:52:26+00:00

Good morning, mysql query which displays cases that have a date field completed &

  • 0

Good morning, mysql query which displays cases that have a date field completed & a total row amount, I want calculate this against the total cases but unsure if I can do all this inside one query. For example the current query outputs

Aug Sep Nov Total
10  20  20  50

The code for that being

     SELECT * from(
     Select Count(b.CaseID) As TotDB 
     from tblcontacts a 
     Inner Join  tblcases b 
     On a.ContactID = b.ContactAssignedTo)a
CROSS JOIN
    (Select
  Sum(Month(b.StatusSubmittedDate) = 8) As Aug,
  Sum(Month(b.StatusSubmittedDate) = 9) As Sep,
  Sum(Month(b.StatusSubmittedDate) = 10) As Oct,
  Count(b.CaseID) As Total,
  ROUND (100*Count(b.CaseID)/Count(b.CaseID),2) As Conversion
From
  tblcontacts a Inner Join
  tblcases b On a.ContactID = b.ContactAssignedTo
Where
  b.StatusSubmittedDate > '2012 - 01 - 01'
Group By
  a.ContactFullName With Rollup
Having
  Sum(b.CaseCommission) > 0.01)b 

What I need to it output is the below so I added the TotDB line above to see if that would help, it didn’t. What I need to find out is can I have a column in this query that bypasses the where/having clause to display all records

Aug Sep Nov Tot TotDB %Converted
10  20  20  50  100   50%

Thanks

  • 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-10T19:52:27+00:00Added an answer on June 10, 2026 at 7:52 pm

    probably you should do like this:

    select Aug,Sep, Nov, Tot,TotDB,(Tot/TotDB*1.0)*100 as '%Converted' 
     from 
    (SELECT * from(
         Select Count(b.CaseDate) As TotDB 
         from tblcontacts a 
         Inner Join  tblcases b 
         On a.ContactID = b.ContactAssignedTo)a
    CROSS JOIN
        (select  
          Sum(Month(b.StatusSubmittedDate) = 9) As Sep,
          Sum(Month(b.StatusSubmittedDate) = 10) As Oct,
          Sum(Month(b.StatusSubmittedDate) = 11) As Nov,
          Count(b.CaseID) As Total,
        From tblcontacts a 
        Inner Join tblcases b 
        On a.ContactID = b.ContactAssignedTo
        Where
          b.StatusSubmittedDate > '2012-01-01'
        Group By
          a.ContactFullName With Rollup
        Having
          Sum(b.CaseCommission) > 0.01)b)c
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good morning, I have the mysql query below to display the years sales which
Good morning, I have mysql queries where I would like to calculate percentage of
Good morning gang. I have a jQuery Datepicker object that is prepoulated using a
Good Morning, I'm starting a PHP/MySQL project that will include a registration page where
Good morning all, I'm trying to use a smarty MySql one-line that will do
Good morning, I have found that many of my customers have MS Access already
Good morning! We have a SVN-Repository, which holds a VS-Solution. In this solution are
Good Morning, I have a SharePoint site that I've been trying to fix up
Good morning all. I have an issue with a query. I want to select
Good morning all, i want to create an event in MySQL that will UPDATE

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.