UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Is there a way to concatenate subrecords instead?    
 
   
bnelson333
post Feb 25 2009, 09:18 AM
Post #1

UtterAccess Veteran
Posts: 409
From: Minnesota, USA



I have a feeling the answer is no, but I thought I'd ask anyway.

In strict SQL (because this is actually for a pass-through query), can you concatenate subrecords instead of repeating them?

E.g. if you had a table called tblOwners and a subtable called tblPets, if I have 3 pets, it might look like this:

Owner.....Pet
Brian.......Fido
Brian.......Goldy
Brian.......Silly

Could you rewrite your query to show:
Owner.....Pet
Brian.......Fido, Goldy, Silly

without resorting to VBA?

Thanks!
Go to the top of the page
 
+
Doug Steele
post Feb 25 2009, 09:45 AM
Post #2

UtterAccess VIP
Posts: 17,638
From: Don Mills, ON (Canada)



Without resorting to VBA? Not really.

If you knew the maximum possible number of subrecords, you could join the table to itself multiple times, extracting only one subrecord for each instance and concatenate that way, but it would be slow and messy.
Go to the top of the page
 
+
bnelson333
post Feb 25 2009, 09:46 AM
Post #3

UtterAccess Veteran
Posts: 409
From: Minnesota, USA



Thanks Doug, that's what I figured. I already have a VBA function that does this, was hoping to speed it up a touch, but it'll have to do.
Go to the top of the page
 
+
seguinsoftware
post Feb 25 2009, 10:01 AM
Post #4

UtterAccess Guru
Posts: 726
From: Maine, US



Try a cross tab query.
Go to the top of the page
 
+
Larry Larsen
post Feb 25 2009, 10:38 AM
Post #5

UA Editor + Utterly Certified
Posts: 22,722
From: Melton Mowbray,Leicestershire (U.K)



Hi
Check out: How to Concatenate Data from the 'Many' Side of a Relationship
HTH's
(IMG:http://www.utteraccess.com/forum/style_emoticons/default/thumbup.gif)
Go to the top of the page
 
+
tonez90
post Jun 3 2009, 10:23 PM
Post #6

UtterAccess Addict
Posts: 187
From: Darwin, Australia



Hi,

I too have a similar request. So is it possible to post your solutions? I am using a query to poulate a report and wish to concatendate licence information into one line like the original example post.

Any help appreciated.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 01:19 PM