[AccessD] Consolidating two sets of values
jack drawbridge
jackandpat.d at gmail.com
Fri May 1 22:43:38 CDT 2015
David;
Small sample based on your data:
Select Names, sumofsales from
(
SELECT IIf(Empname="Bob" Or EmpName="Jim","GEN",empname) AS Names,
Sum(tblSales.Sales) AS SumOfSales
FROM tblSales
GROUP BY IIf(Empname="Bob" Or EmpName="Jim","GEN",empname)
)
Gives result:
*Query3* Names sumofsales GEN $7,000.00 Joe $1,000.00 Lee $8,000.00
Good luck.
On Fri, May 1, 2015 at 11:04 PM, David Emerson <newsgrps at dalyn.co.nz> wrote:
> Hi Listers,
>
>
>
> I am having a brain freeze at the moment. I have a table with three
> fields:
> Employee, Date, Sales.
>
>
>
> Up to now the client wanted the total for each employee. No problem:
>
>
>
> SELECT tblSales.Employee, Sum(tblSales.Sales) AS SumOfSales
>
> FROM tblSales
>
> GROUP BY tblSales.Employee;
>
>
>
> Now the client wants the same except he wants two employee figures to be
> combined into one figure. For example
>
>
>
> Results of current query:
>
>
>
> Bob $5000
>
> Jim $2000
>
> Joe $1000
>
> Lee $8000
>
>
>
> Now let's say that Bob and Jim are to be combined as Gen. The results are
> now to be:
>
>
>
> Gen $7000
>
> Joe $1000
>
> Lee $8000
>
>
>
> What is the syntax I should use?
>
>
>
> Regards
>
> David Emerson
> Dalyn Software Ltd
> Wellington, New Zealand
>
>
>
>
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
More information about the AccessD
mailing list