Jump to content

SUM function question regarding GROUP BY


j.smith1981

Recommended Posts

I have a problem or question regarding the SUM function.

 

I know we have to group by a column for to allow the use of the SUM function to total up a numeric value of a column.

 

Whats the easiest way, (I suppose this could be a PHP problem), to show all details in rows rather than combining them in one result.

 

Say this following example:

 

(state as it is now)

 

Orderid  Total  Status

order1  | 10  | C

order2      35    C

 

Then when I group it:

 

order1  | 10  | C

 

How would I show both these results (as in both orderid 1 and orderid 2) in mysql but then totalling them up?

 

Kind regards,

Jeremy.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.