Select Sum(..) etc

Frank Schima macsforever2002 at yahoo.com
Fri Feb 21 11:07:16 CST 2003


--- Gunnar Swan <GunnarSwan at practicetopass.com> wrote:
> To use SUM, do you not have to use a GROUP BY ?
> 
> >>> SUM(Cost),SUM(OBV),SUM(SalePrice),Sum(DeprRec),Sum(capgain) from reportData

No GROUP BY is needed. This is valid SQL normally - assuming all fields are in the same
table. Adding a WHERE clause is also valid. 

Adding a regular (non-calculated) field into this SELECT clause is not allowed in some
(MySQL), but legal in others (Sybase). I'm not sure about it in SQL92. 


-Frank


=====
Frank Schima                <mailto:frank-list at labrecyclers.com>
Lab Recyclers Inc.          <http://www.labrecyclers.com/>
Gaithersburg, MD USA        <http://www.ci.gaithersburg.md.us/>

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/


More information about the Valentina mailing list