|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
total of value in column (field)
//This gives me the the quanitity of each item,
//and the total cost of each item .. $query = "SELECT COUNT(Transaction.ItemID)AS QTY, SUM(Items.Buyer_pays)AS TOTALS, Items.Name,Items.Short_Disc,Items.Buyer_pays FROM Items, Transaction WHERE Transaction.ItemID = Items.ItemsId AND Transaction.TransactionCode = '" . $sess_id ."' GROUP BY Items.Name"; //How do i calculate the total cost of all the SELECET'ed items.. |
|
#2
|
|||
|
|||
|
RE: total of value in column (field)
Well, if you happen to be running mysql 4.1.1 you can use the WITH ROLLUP modifier. If you aren't so lucky to be using that version of mysql, you will need to add the values up with PHP as you pull each row...
(If you are using MSSQL or another database, you probably also have the WITH ROLLUP modifier) |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > total of value in column (field) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|