Reply to Re: Quicker calculations on MySQL

Your name:

Reply:


Posted by MS on 10/10/27 11:17

Try

GROUP BY ord
http://dev.mysql.com/doc/mysql/en/select.html

SELECT *,count(ord) AS CountOrd FROM tbl_name
GROUP BY ord

CountOrd would then contain the total counts of the variables within ord
--
----------------------------------------------------------------------------
http://www.clickonlingerie.com?SIG - Exotic Erotic Lingerie
----------------------------------------------------------------------------


"Brian" <not@given.com> wrote in message
news:j7_me.2891$cN2.920@newsfe4-gui.ntli.net...
> Hi all
>
>
>
> I'm running a query in a PHP script. At the moment I have having to run a
> while ($myrow = mysql_fetch_array($result)) {...
>
>
>
> As it loops though is has to add up a number of columns, is there a
quicker
> sql statement then doing this the following
>
>
>
> if ($ch == 'n') {
>
> $notrecognisedcount = $myrow[ord];
>
> }
>
> if ($ch == 'u') {
>
> $discontinuedcount = $myrow[ord];
>
> }
>
> if ( ($ch != 'n') && ($ch != 'u') ) {
>
> $validorderscount = $myrow[ord];
>
> $delivered = $myrow[del];
>
> }
>
>
>
>
>
>
>
> Brian
>
>
>
>

[Back to original 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

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