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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:37:59+00:00 2026-05-25T19:37:59+00:00

I want to write the query to calculate the amount as per current day

  • 0

I want to write the query to calculate the amount as per current day and monthly.

I have TransactionID, Date, Amount columns in my Charge table.

I want it in this format:

currentDayAmount              TotalMonthlyAmount
$12305                        $236589                  --suppose on 31 Aug 2011
$62598                        $365489                  --suppose on 30 Sep 2011

Here CurrentDayAmount is which date I entered to excute the query and TotalMonthlyAmount is which month I entered the date. It means I want to execute with three dates. First is for the day which I want to run the query and last two is range of dates which is needs to total monthly amount.
I execute the below query but shows the correct data but shows in rows.

select sum(c.amount) 
from charge c 
where c.eDate between '09/16/2011' and '09/17/2011'
union all 
select sum(c1.amount) 
from charge c1
where c1.eDate between '09/01/2011' and '09/20/2011'

Result

$33256.25
$705826.36

I want this data in columns as

current            Monthly
$33256.25          $705826.36

I hope this information is enough to understand u what I want to do.
Please give any suggestion or query to resolve my issue.

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-05-25T19:37:59+00:00Added an answer on May 25, 2026 at 7:37 pm

    Try this:

    SELECT
        currentDayAmount = (
                             SELECT
                                SUM(c.amount)
                             FROM
                                charge c
                             WHERE
                                c.eDate BETWEEN '09/16/2011' AND '09/17/2011'
                           )
      , TotalMonthlyAmount = (
                               SELECT
                                SUM(c1.amount)
                               FROM
                                charge c1
                               WHERE
                                c1.eDate BETWEEN '09/01/2011' AND '09/20/2011'
                             )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write SQL query which select some columns from the first table
I want to write a query to select from a table all rows with
I'm trying to write a query I don't want to have Cartesian products on.
I have the following table which records a value per day. The problem is
I want to write a query like this: For a table that has these
I have two tables 'country' and 'destination'. And i want to write a query
I have a database schema like this picture: I want to write a query
i have a array of strings i want to write a query such that
I want to write a query like this: SELECT o.OrderId, MAX(o.NegotiatedPrice, o.SuggestedPrice) FROM Order
i want to write a query with Full-Text-Search on a column with varbinary(max) type

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.