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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:35:19+00:00 2026-06-17T02:35:19+00:00

I have a table that lists service calls for employees. i have a view

  • 0

I have a table that lists service calls for employees. i have a view set up to view the sum of the invoices in the table.

Select EmployeeID, SUM(InvoiceAmount) as "Total $ Amount Of Calls For January"
From Calls
WHERE Date BETWEEN '2013/01/01' AND '2013/01/31'
Group by EmployeeID

this works great but i have to do it twelve times to view each month and this seems a bit redundant. i would like to be able to use a sub query to display EmployeeID and then list each month with totals underneath.

EmployeeID   JAN   FEB   MAR   APR ...
john         444   555   342   654
jim          945   675   232   465

ive tried a bunch of things and cant get even close…i need something like this, but that works…

SELECT   
EmployeeID, 

(SELECT SUM(InvoiceAmount) FROM Orders WHERE DATE BETWEEN '2013/01/01' AND '2013/01/31') AS JAN,

(SELECT SUM(InvoiceAmount) FROM Orders WHERE DATE BETWEEN '2013/02/01' AND '2013/02/28') AS FEB,

(SELECT SUM(InvoiceAmount) FROM Orders WHERE DATE BETWEEN '2013/03/01' AND '2013/03/31') AS MAR,

FROM Calls
  • 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-17T02:35:20+00:00Added an answer on June 17, 2026 at 2:35 am

    You can do something like this:

    SELECT EmployeeID, 
        SUM(
            CASE
                WHEN strftime('%m', Date) = '01'
                    THEN InvoiceAmount
                ELSE 0
            END) AS 'Jan',
        SUM(
            CASE
                WHEN strftime('%m', Date) = '02'
                    THEN InvoiceAmount
                ELSE 0
            END) AS 'Feb',
        ...
        SUM(
            CASE
                WHEN strftime('%m', Date) = '12'
                    THEN InvoiceAmount
                ELSE 0
            END) AS 'Dec'
    FROM Calls
    WHERE Date BETWEEN '2013-01-01' AND '2013-12-31'
    GROUP BY EmployeeID
    

    This works well if you’re looking at a particular year.

    See it in action

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

Sidebar

Related Questions

Say you have a ServiceCall database table that records down all the service calls
I have the following table that lists all awarded cups: Name: Cups Columns: Month,
Hi I have one web service connected to one db that has a table
(Advantage Database Server) I have a table of service providers that, for auditing purposes,
I have a service that calls database to retrieve data; this service will return
Here is my situation: I have one table that contains a list of drugs
I have a table that contains multiple dropdown menus for a list of profile
I have a DB table that contains a comma separated list of ID's (ints)
We have a table value function that returns a list of people you may
I have a mysql table (table-A) that contains a list of unique product ids.

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.