Re: Quicker calculations on MySQL
- From: "MS" <nospamplaesegr8t_ukuk@xxxxxxxxxxx>
- Date: Tue, 31 May 2005 14:37:07 +0000 (UTC)
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@xxxxxxxxx> wrote in message
news:j7_me.2891$cN2.920@xxxxxxxxxxxxxxxxxxxxxxx
> 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
>
>
>
>
.
- References:
- Quicker calculations on MySQL
- From: Brian
- Quicker calculations on MySQL
- Prev by Date: Followup Question Re: Read/write Excel spread*** libraries
- Next by Date: Re: How to change pictures everyday using php
- Previous by thread: Quicker calculations on MySQL
- Next by thread: Re: Quicker calculations on MySQL
- Index(es):