[ciapug] SQL Question

Tony Bibbs tony at tonybibbs.com
Mon Jun 13 11:55:43 CDT 2005


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
> 


More information about the ciapug mailing list