You are here: Re: How to sum the table records? « PHP Programming Language « IT news, forums, messages
Re: How to sum the table records?

Posted by Rik on 05/07/06 12:33

Alex Murphy wrote:
> Hi all,
>
> I using the "list" function to extract the sales text delimited file
> and insert into the table. How to find out the best sales item and
> worst sales item?

Summing is easy:

SELECT `item`, SUM(`qty`) AS 'total_sold' FROM table_name GROUP BY `item`

Extracting best and worst in one query in one go is a little bit trickier.
I'm sure it's possible in one query, but I'm not familiar enough with JOINS
or subqueries to figure that one out.

That's more of a database question, which database are you using?

Grtz,
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация