P
pupli
Hi everybody,
I need some with the results of a query.
I have this table
EMPLOYES
-------------------------
Name |Salary |Company |
-------------------------
Andrew | 1245 | ABC |
-------------------------
Mark | 1521 | ASD |
-------------------------
Mary | 5484 | EDC |
-------------------------
Andrew | 5124 | DEA |
-------------------------
John | 3521 | ASD |
-------------------------
John | 6124 | DEA |
-------------------------
I want my query to output the following result:
Name Salary Company
----- ------- --------
Andrew 6369 ABC + DEA
Mark 1521 ASD
Mary 5484 EDC
John 9645 ASD + DEA
How can I do this, with the "Company" field?
This field is of type string
The only thing I can say, is that I can realise this output on a SQL Server
by running this query:
SELECT t.Name,t.Salary,LEFT(cl.CompList,LEN(cl.CompList)-1) AS Company
FROM (SELECT Name,SUM(Salary) AS Salary
FROM EMPLOYEES
GROUP BY Name) t
CROSS APPLY (SELECT Company+ '+'
FROM EMPLOYEES
WHERE Name=t.Name
FOR XML PATH(''))cl(CompList)
===
How's it possible in access 2003 (or even 2002) ?
I need some with the results of a query.
I have this table
EMPLOYES
-------------------------
Name |Salary |Company |
-------------------------
Andrew | 1245 | ABC |
-------------------------
Mark | 1521 | ASD |
-------------------------
Mary | 5484 | EDC |
-------------------------
Andrew | 5124 | DEA |
-------------------------
John | 3521 | ASD |
-------------------------
John | 6124 | DEA |
-------------------------
I want my query to output the following result:
Name Salary Company
----- ------- --------
Andrew 6369 ABC + DEA
Mark 1521 ASD
Mary 5484 EDC
John 9645 ASD + DEA
How can I do this, with the "Company" field?
This field is of type string
The only thing I can say, is that I can realise this output on a SQL Server
by running this query:
SELECT t.Name,t.Salary,LEFT(cl.CompList,LEN(cl.CompList)-1) AS Company
FROM (SELECT Name,SUM(Salary) AS Salary
FROM EMPLOYEES
GROUP BY Name) t
CROSS APPLY (SELECT Company+ '+'
FROM EMPLOYEES
WHERE Name=t.Name
FOR XML PATH(''))cl(CompList)
===
How's it possible in access 2003 (or even 2002) ?