Thanks!!!

I appreciate all the help I can get.

I am trying to validate what appears to be a working query, and will
post back to the list as soon as I can confirm it works.

I think many others will benefit from my working this out..

Thanks again and all my best!

~Kelly W. Black

-----Original Message-----
From: James Northcott [mailto:jnorthcott@;dpmg.com]
Sent: Monday, November 04, 2002 2:29 PM
To: Black, Kelly W [PCS]
Subject: RE: Interesting Challenge


> I have tried with and without having. Neither works.
>
> If you try running the query without cell, or sector, the
> result is an sql query error.....

I would remove both cell and sector from select, and move the having stuff
into the where clause.

Why don't you try just:

select sum(att) as att from ss where release=CURDATE() and sector=1 AND
(cell=148 or cell=3)

> I will try that link...thanks for the input.
> 
> ~Kelly W. Black
> 
> -----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_Refe
rence.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