Solved

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

Posted on 2008-10-15
3
371 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now