MySQL Forums
Forum List  »  General

How to show Subtotals?
Posted by: sbailey
Date: July 27, 2004 12:26AM

How can you show SUBTOTALS in the same column as the data, NOT in a separate column?

In my SELECT statement I have GROUP BY. I need to SUBTOTAL each resulting group, in the same column as the data. See the subtotals 700 and 200 under Field 3 below (I really have 21 columns). Also I must show one blank row after each resulting group:

Field1 Field2 Field3 Field4
entry1 data2.1 100 data4.1
entry2 data2.2 400 data4.2
entry3 data2.3 200 data4.3

entry4 data2.4 500 data4.4
entry5 data2.5 300 data4.5

How can you show subtotals using MySQL ONLY, without also learning something else like PHP or PERL ? I'm new to databases, just learning MySQL, and it will be a long time before I can learn anything else. Thank you for any help.

Options: ReplyQuote

Written By
How to show Subtotals?
July 27, 2004 12:26AM
December 11, 2004 07:16AM
January 05, 2005 03:28PM

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.