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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:27:56+00:00 2026-05-25T03:27:56+00:00

Current db structure payment ID pending paid begin_work end_work status —————————————————- 1 100 20

  • 0

Current db structure payment

ID pending  paid    begin_work  end_work    status
----------------------------------------------------
1  100      20      2011-08-01  2011-08-30  pending 
2  200      1000    2011-08-01  2011-08-15  pending 
3  500      100     2011-08-05  2011-08-25  pending
4  0        200     2011-07-1   2011-08-25  paid  

How do I sum pending & paid payment between current month & status?

$qm = $db->query("
   SELECT
   begin_work, end_work, status,  
   SUM(pending) AS mpending, 
   SUM(paid) AS mpaid
     FROM payment
    ")  

Results for August 2011 should be

 pending = 800
 paid    = 1320
  • 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-25T03:27:57+00:00Added an answer on May 25, 2026 at 3:27 am

    You’d need a group by clause:

    SELECT begin_work, end_work, status, SUM(pending), SUM(paid)
    FROM payment
    GROUP BY YEAR(begin_work), MONTH(begin_work)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

maybe i am wrong but i seriously i don't like the current structure of
I have the current basic structure for each domain object that I need to
What is the current method of implementing the joined-subclass structure with FluentNHibernate? By current,
How do I locate the current file in the project structure? (Similar to Visual
The current structure is as follows: Table RowType: RowTypeID Table RowSubType: RowSubTypeID FK_RowTypeID Table
Below is my current structure for MySQL database id | item_name | item_files ------------------------------------------
My current project structure is made to do logging of exceptions and such into
I have the current structure; Item 1 - Subitem 1 - Subitem 2 -
I have a single SVN repository with the following current structure: project1 branches trunk
Here is my current structure plugins/ |---init.php |---/plugin1/lib/ |---/plugin2/lib/ |---/Symfony/ I have my code

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.