0

Input

Date            Points            Email

2012-07-01       5                 [email protected]
2012-07-01       6                [email protected]
2012-07-01       2                 [email protected]

2012-07-02       5                [email protected]

2012-07-03       8                [email protected]
2012-07-03       7                 [email protected]
2012-07-03       1                 [email protected]

2012-07-04       3                [email protected]
2012-07-04       2                [email protected]

2012-07-05       3                [email protected]
2012-07-05       9                [email protected]

Output

Date            Points

2012-07-01       13
2012-07-02        5
2012-07-03       16
2012-07-04        5
2012-07-05       12

Suggest me an MySQL Query for output like the above

1

2 Answers 2

3

try

 SELECT `date`, SUM(`Points`) AS sumPoint FROM table GROUP BY `date`

Note : dont forget to wrap date column with ` as DATE is reserve keyword of mySQL

Sign up to request clarification or add additional context in comments.

Comments

0

SELECT date, SUM(Points) AS sumPoint FROM table GROUP BY DATE(date)

Since date column might be datetime or date type in table

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.