Jump to content

How to sum rows?


Darkness Soul

Recommended Posts

Yo,

I need a little help, maybe its simple, but i don't know how to do it!

At the index page, I have a table, with cars to be sold! like..

[table][tr][td]id ---[/td][td]36x ---[/td][td]60x ---[/td][/tr][tr][td]1 [/td][td]15[/td][td][/td][/tr][tr][td]1 [/td][td][/td][td]8[/td][/tr][tr][td]2 [/td][td]10[/td][td][/td][/tr][tr][td]3 [/td][td]25[/td][td][/td][/tr][tr][td]3 [/td][td][/td][td]12[/td][/tr][/table]

What I'm suppose to do, to sum these rows, and return something like it?:

[table][tr][td]id ---[/td][td]36x ---[/td][td]60x ---[/td][/tr][tr][td]1 [/td][td]15[/td][td]8[/td][/tr][tr][td]2 [/td][td]10[/td][td][/td][/tr][tr][td]3 [/td][td]25[/td][td]12[/td][/tr][/table]

The data come from 3 tables, using joins.. someone know how i do to simplify this table?

Thank you!!

D.Soul
Link to comment
Share on other sites

Oh... you want to collapse/compress this layout... it sounds like you'll have to do it yourself in PHP, if you're getting back one row-one record.  It may be possible do accomplish this with a very ugly looking query, but I don't really see the point.
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.