MySQL Forums
Forum List  »  General

CSV export has different values to SQL output
Posted by: S D
Date: October 28, 2020 07:14PM

I have a SQL statement

SELECT `datepaid`, SUM(`total`) FROM `tblinvoices` WHERE `status` = "paid" AND `total` > 0 GROUP BY YEAR(datepaid)*100 + MONTH(datepaid) ORDER BY `datepaid` ASC

The output is as expected, I get a list of totals grouped by month, ordered by month. The last 5 rows look like this:

2020-06-09 13:01:31 4485.56
2020-07-07 12:36:25 4519.69
2020-08-03 13:02:29 3685.26
2020-09-26 05:49:25 4371.98
2020-10-10 16:47:32 5135.75

I am using phpMyAdmin and at the bottom of the list of all rows, I check all, then click export (under the results, not in the top menu).

In the resulting CSV the last 5 rows are

"2020-06-09 13:01:31","29.00"
"2020-07-07 12:36:25","130.50"
"2020-08-03 13:02:29","99.00"
"2020-09-26 05:49:25","385.00"
"2020-10-10 16:47:32","46.20"

It looks like the output has included one of the rows in the group, rather than the group total.

Am I doing something wrong (most likely) or is this some sort of bug?

Options: ReplyQuote


Subject
Written By
Posted
CSV export has different values to SQL output
S D
October 28, 2020 07:14PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.