473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

I cannot figure out this query - I thought it would be simple but...

su
I am having trouble creating a query that ouputs each of the children
associated with a parent. Here is a simplification of my tables:

tblParent
Parent_ID
A
B
C

tblChild
Child_ID Parent_ID
1 A
2 A
3 A
4 B
5 C
6 C

Desired Result:
Parent_ID Children
A 1,2,3
B 4
C 5,6
The desired result set would have the parent as well as each of the
parent's children concatenated together. Any ideas how to do this in
SQL? I could do it in code, but unfortunately it's not an option in
this case. I need to do it in an Access query since I need the results
in a query for a Word merge.

Any help would be appreciated!!!!!!

Nov 13 '05 #1
2 1182
Su,
SQL isn't really made to do this. You could use a cross-tab in Jet to do
this or the documented method of making cross-tab views in SQL Server using
CASE but even then you end up with a two-dimensional matrix. To convert
this to delimited text in the format you want will still require code. I'd
charge overtime to write this and make sure I got paid half up front in
combat pay. If my customer balked I'd refuse to write it and consider
myself lucky to be free of an obnoxious client.

"su" <sb****@canoemail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I am having trouble creating a query that ouputs each of the children
associated with a parent. Here is a simplification of my tables:

tblParent
Parent_ID
A
B
C

tblChild
Child_ID Parent_ID
1 A
2 A
3 A
4 B
5 C
6 C

Desired Result:
Parent_ID Children
A 1,2,3
B 4
C 5,6
The desired result set would have the parent as well as each of the
parent's children concatenated together. Any ideas how to do this in
SQL? I could do it in code, but unfortunately it's not an option in
this case. I need to do it in an Access query since I need the results
in a query for a Word merge.

Any help would be appreciated!!!!!!

Nov 13 '05 #2
use fConcatChild from access web on tblChild. then if you want, you
can query that and stuff names in.

http://www.mvps.org/access/modules/mdl0004.htm

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
8
by: Kragen Sitaker | last post by:
ERROR: Cannot insert a duplicate key into unique index pg_class_relname_nsp_index We've been getting this error in our application every once in a while --- typically once an hour to once a day,...
8
by: wASP | last post by:
Hi, I'm having a problem referencing the elements within an object after a method of that object (a member function) has been activated with an onsubmit handler: - - - - - - - - ...
7
by: Mathew Butler | last post by:
I'm investigating an issue I have when pulling data back from MS access I'm retrieving all rows from a column in a table of 5000 rows - accessing a column of type "memo" ( can be 65353 character...
2
by: sara | last post by:
I have been working this idea for a little over a week now and am not convinced I have a good solution. I have a little system that tracks Purchase Orders (POKey autonum, PONum are both ont...
10
by: sara | last post by:
I have been volunteered to write a simple system to help a non-profit enter and track information on the elders they serve. (It's actually a fascinating activity, and very rewarding to be helping...
4
by: Massimo | last post by:
I have a very very strange situation with a particular application and sql server 2005 enterprise. This application combines numerical data from multiple tables. User can make query over this...
3
by: epearce301 | last post by:
Hi, I have table1 and table2, both are linked, and a query has been run. I created forms that use both just the tables, and then another one using just the query. All of the information is there,...
7
by: php_mysql_beginer911 | last post by:
Hi .. hope someone will help i am trying to figure it out why i cannot post string "union select" every time i try to post data which content union and select .. the page doesn't get posted and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.