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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:55:49+00:00 2026-06-02T02:55:49+00:00

can anyone help me out with one query? i have a DB that looks

  • 0

can anyone help me out with one query?
i have a DB that looks like this:
table expenses

paydate       receiver   payment
2011-05-06     SOLO       3000
2011-05-08     Walmart    5000
2011-05-09     McDonalds  400
2011-05-08     Korona     700
2011-05-08     Walmart    1000
2011-05-09     BigZ       1300

I have to calculate the sum of all payments in the day when the max payment was done.
the result should look like this:

paydate       payment
2011-05-08    6700

i managed to find the max payment and the paydate of it:

SELECT payment, paydate FROM expenses WHERE payment=(SELECT max(payment) FROM expenses);

but it only gives me the max payment and paydate, and i need a sum of the payments on that day.

  • 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-02T02:55:50+00:00Added an answer on June 2, 2026 at 2:55 am
    CREATE TABLE `t` (
    `t1` INT(10) NULL DEFAULT NULL,
    `t2` DATE NULL DEFAULT NULL,
    `t3` INT(10) NULL DEFAULT NULL
    )
    
    
    INSERT INTO `t` (`t1`, `t2`, `t3`) VALUES
    (1, '2012-04-19', 100),
    (2, '2012-04-18', 200),
    (3, '2012-04-18', 300),
    (4, '2012-04-19', 150);
    

    and query:

    select sum(t3), t2 from t  where t2=(select t2 from t where t3 = (select max(t3) from t))
    

    result gives us 500 and 2012-04-18, i.e. sum and date

    or check this:

    select t1, sum(t3), t2 from t  where t2=(select t2 from t where t3 = (select max(t3) from t)) group by t1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone help me figure out whats wrong with this piece of xaml code?
Anyone that can help me out will be very much appreciated. I seem to
Can anyone help? I have a PHP method that sends an http post: <?php
Can anyone help me out please? I'm confused. I want to set up my
can anyone help me out with the syntax and example for the target server
I am new in Blackberry. Can anyone help me out for following queries? Which
I am new in Symbian UIQ. So anyone can help me out about following
Can anyone please help me to work out how to achieve the following? I
Can anyone help? I have been using the entity framework and its going well
I have a make table query that is used to run a report (due

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.