This simply returns me to the documentation.

Thanks....

-----Original Message-----
From: James Northcott [mailto:jnorthcott@;dpmg.com]
Sent: Monday, November 04, 2002 12:13 PM
To: Mysql (E-mail)
Subject: RE: Interesting Challenge


> mysql> SELECT cell, sector,

If you only want one row, then selecting cell doesn't make any sense.
Cell is different in each row you've selected.  If you only want one
row, don't select cell.

>     -> sum(att) as att,
>     -> sum(lc) as lc,
>     -> sum(csh) as csh,
>     -> ROUND((SUM( lc + csh ) * 100 ) / (SUM(att) - SUM(tccf 
> + bpp + bpc +
> suf)),2) AS drops,
>     -> sum(tccf) as tccf,
>     -> sum(bpp) as bpp,
>     -> sum(bpc) as bpc,
>     -> sum(suf) as suf,
>     -> ROUND(SUM( tccf + bpp + bpc + suf) *100 / SUM(att),2) 
> AS blocks,
>     -> sum(mou) as mou
>     -> FROM ss
>     -> WHERE release=CURDATE()
>     -> GROUP BY cell

"Group by cell" means "Give me a total for each cell".  If you only
want one row, you don't need a group by at all; if you want one row
per sector, you should group by sector.

>     -> HAVING sector=1 AND (cell=148 or cell=3);

This doesn't belong in the Having clause.  This needlessly slows
you query down.  This can go in the where clause.  See
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#SEL
ECT.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to