Concatinated String with grouped result?

S

sid derra

Hi folks... coming from regular SQL and Oracle, i wonderd if you could help
me on how to accomplish the following task in ms access. Thanks a lot in
advance for that!

Here is the table structure:

Table Mag

ID | Issue | Pages | Title
----+-------+-------+-----------------
1 1 3 'Some Title'
2 2 2 'Another Value'
3 2 2 'And heres another one'
4 2 5 'Lotsa Articles'
5 3 2 'New Issue'
6 3 1 'Last one!'


My query:

SELECT Issue, SUM(Pages) AS TotalPages
FROM Mag
GROUP BY Issue
ORDER BY Issue;


So far so good - the output looks like this:

Issue | TotalPages
-------+------------
1 3
2 9
3 3

How can i get the result to also get me a 3rd (String) field in the result
set, that holts a comma delimited list of the Article titles for each group?

i.e., the result should look like this:

Issue | TotalPages | Titles
-------+------------+-------------------------------------------------------
1 3 'Some Title'
2 9 'Another Value, And heres another one, Lotsa Articles'
3 3 'New Issue, Last one!'

thanks! sid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top