[ciapug] SQL Question
Dave J. Hala Jr.
dave at 58ghz.net
Mon Jun 13 11:50:30 CDT 2005
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
--
Open Source Information Systems (OSIS)
Dave J. Hala Jr. <dave at osis.us>
641.485.1606
More information about the ciapug
mailing list