Solved

Access query:contantenate "page number" if part ID filed is duplicate

Posted on 2008-10-15
3
387 Views
Last Modified: 2012-05-05
Hi, Please give me the SQL  to concatenate the page# with a comma, if the part ID is a duplicate.  in the  examples below, I would like to see widget_001 only display 1 row and to concatenate pages "2" and "10"  as  " 2, 10"  

example of non concatenate:            
      A                     B
1      part_ID      page#
2      widget-001      2
3      widget-001      10
4      widget-002      6`
5      widget-003      50
           
           
desired results:            
      A                   B
1      part_ID      page#
2      widget-001      2, 10
4      widget-002      6`
5      widget-003      50


SELECT C.PART_ID, C.[PAGE #]
FROM C;

Open in new window

0
Comment
Question by:gringotani
  • 2
3 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 22719600
Can't be done in Jet SQL.

You have to write code to do the concatenation.
0
 

Author Comment

by:gringotani
ID: 22722013
I want to do it in Access. what is the SQL code?
0
 
LVL 77

Accepted Solution

by:
peter57r earned 50 total points
ID: 22728486
JET SQL = Access SQL.

It can't be done in SQL.

You have to create a function in VBA and use the function in your sql statement.
There is an example with generic code here:
http://www.eggheadcafe.com/software/aspnet/32316648/concatenate-values-from-m.aspx
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question