[AccessD] select distinct per year

Arthur Fuller artful at rogers.com
Mon Apr 21 06:44:54 CDT 2003


In SQL the query is:
 
select datepart(yyyy,dateentered), sum(num1), sum(num2)
from TableA
group by datepart(yyyy,dateentered)
 
In Access, substitute the year() function for datepart().
 
Arthur

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Pedro Janssen
Sent: April 21, 2003 6:51 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] select distinct per year


Hi Susan,
 
i thought this could be done with a select distinct, but i wasn't sure
 
This what i have
 
TableA
 
Date                           num1            num2
01-02-2000               5,2                   4,1
02-03-2000               4,6                   4,3
01-04-2001               4,2                   6,5
14-07-2001               6,2                   3,1
 
 
This is what i want;
in this example the calculation is sum
 
Date                          num1              num2
2000                          9,8                    8,4
2001                          10,4                  9,6
 
Pedro Janssen
 
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030421/9263bf9a/attachment-0001.html>


More information about the AccessD mailing list