[ciapug] SQL Question

Dave J. Hala Jr. dave at 58ghz.net
Mon Jun 13 12:03:29 CDT 2005


I was afraid that was what the answer was going to be.

:) Dave





On Mon, 2005-06-13 at 11:55, Tony Bibbs wrote:
> You're basically stuck with writing some PHP code to do this for you. 
> Been there, done that.  In the end I did eliminate the roadblocks that 
> let me upgrade to MySQL 4.  Now all I need from them is support for 
> triggers/sp and views.
> 
> --Tony
> 
> Dave J. Hala Jr. wrote:
> > I'm using a grouping sql statement to return a list of unduplicated
> > records:
> > 
> > SELECT id, afn,fnm,lnm,dat,prgdsc,svc,cor,cos,zip,cit,x,y,z FROM
> > `snapshot` 
> > GROUP BY by afn,svc
> > having svc='L1AA' and cit='Marshalltown'
> > ORDER by afn;
> > 
> > I'd like to sum the x,y,z columns from the result within the same query.
> > This seems like a perfect candidate for a sub-select. However, I'm using
> > mysql 3.x
> > 
> > I could dump the records in a temp table and sum the columns, but I was
> > looking for a way to make the sql server do it in single step. Anyone
> > got any ideas?
> > 
> > Upgrading to mysql 4/5 is out of the question, as well as switching to
> > postgres/MSSQL/Oracle...
> > 
> > 
> > :) Dave
> > 
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug
-- 

Open Source Information Systems (OSIS)
Dave J. Hala Jr. <dave at osis.us>
641.485.1606



More information about the ciapug mailing list