473,748 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

rake-them-all-into-a-string query: is that possible?

Dear all,

Suppose there is a table whose records contain a textfield TXT, and a query
that returns a subset of that table. Is it possible to have that query
return all the TXT-fields gathered together in one string? I really have no
idea as to how to tackle this. For clarity, here's an example of what I
mean:

there are three tables

sports guys teams
id name id name id idsport idguy
1 volleybal 1 Tom 1 1 2
2 basketball 2 Dick 2 1 3
3 cricket 3 Harry 3 2 1
.... ... ... ... ... ... ...

Now the query should run something like: select all members of the
volleybalteam ( teams.idguy where idsport=1, and that joined on guys, etc),
and return that in the following single record:

sportsname team
volleybal Tom, Dick

The reason I ask is that I need that record for further processing
elsewhere, so solutions involving forms in any way are no use.

Thanks in advance,

WS
Nov 12 '05 #1
4 1404
It's a common need, and it's not possible in a SQL query. You'll have to
write something in VB to concatenate the strings together, or find a way to
eliminate the need to deal with them in concatenated form.

On Tue, 13 Jan 2004 00:20:41 GMT, wn********@yaho o.com wrote:
Dear all,

Suppose there is a table whose records contain a textfield TXT, and a query
that returns a subset of that table. Is it possible to have that query
return all the TXT-fields gathered together in one string? I really have no
idea as to how to tackle this. For clarity, here's an example of what I
mean:

there are three tables

sports guys teams
id name id name id idsport idguy
1 volleybal 1 Tom 1 1 2
2 basketball 2 Dick 2 1 3
3 cricket 3 Harry 3 2 1
... ... ... ... ... ... ...

Now the query should run something like: select all members of the
volleybaltea m ( teams.idguy where idsport=1, and that joined on guys, etc),
and return that in the following single record:

sportsname team
volleybal Tom, Dick

The reason I ask is that I need that record for further processing
elsewhere, so solutions involving forms in any way are no use.

Thanks in advance,

WS


Nov 12 '05 #2
Hi WS

Dev Ashish wrote a function called fConcatChild to do this.
you'll find it on:

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

HTH

Peter Franklin

On Tue, 13 Jan 2004 00:20:41 GMT, wn********@yaho o.com wrote:
Dear all,

Suppose there is a table whose records contain a textfield TXT, and a query
that returns a subset of that table. Is it possible to have that query
return all the TXT-fields gathered together in one string? I really have no
idea as to how to tackle this. For clarity, here's an example of what I
mean:

there are three tables

sports guys teams
id name id name id idsport idguy
1 volleybal 1 Tom 1 1 2
2 basketball 2 Dick 2 1 3
3 cricket 3 Harry 3 2 1
... ... ... ... ... ... ...

Now the query should run something like: select all members of the
volleybaltea m ( teams.idguy where idsport=1, and that joined on guys, etc),
and return that in the following single record:

sportsname team
volleybal Tom, Dick

The reason I ask is that I need that record for further processing
elsewhere, so solutions involving forms in any way are no use.

Thanks in advance,

WS


Nov 12 '05 #3
wn********@yaho o.com wrote in
news:40******** *************@d reader13.news.x s4all.nl:
Dear all,

Suppose there is a table whose records contain a textfield TXT, and a
query that returns a subset of that table. Is it possible to have that
query return all the TXT-fields gathered together in one string? I
really have no idea as to how to tackle this. For clarity, here's an
example of what I mean:

there are three tables

sports guys teams
id name id name id idsport idguy
1 volleybal 1 Tom 1 1 2
2 basketball 2 Dick 2 1 3
3 cricket 3 Harry 3 2 1
... ... ... ... ... ... ...
Now the query should run something like: select all members of the
volleybalteam ( teams.idguy where idsport=1, and that joined on guys,
etc), and return that in the following single record:

sportsname team
volleybal Tom, Dick

The reason I ask is that I need that record for further processing
elsewhere, so solutions involving forms in any way are no use.

Thanks in advance,

WS


This function (as an example) might help.

You could modify it to match your table and fields. GetString take
parameters as to delimters.

And set one of the calculated fields in your query to return it.

CurrentProject. Connection.Exec ute("SELECT Distinct fldDescription FROM
tbl2002Transact ions ORDER BY fldDescription" ).GetString()

.... assumes AC2K or greater.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #4
Thanks to all, but this was by far the best answer. It is a beautiful base
to work from

WS
Dev Ashish wrote a function called fConcatChild to do this.
you'll find it on:

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

HTH

Peter Franklin

Nov 12 '05 #5

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

Similar topics

1
2841
by: Ira | last post by:
I'm on a hosted Linux server and I have an Outer Join query that's returning on one less row than I expect. There are two rows very similar and I expect them both returned. There are similar other cases of rows all being returned. I've googled: debug mysql query I've searched on mysql.com for 'debug' Alot comes up but all relates to queries returning errors. My query happily returns with one row too little out of 100 rows.
4
1879
by: sah | last post by:
I need some help with the following query: DECLARE @SRV VARCHAR(20), @date smalldatetime SET @SRV = (select @@servername) SET @date = '20040901' select Srv_Name = @SRV, DB_Name = 'DB_NAME', Table_Name = 'Info_Table', Date_of_Records = @date, count(*) AS 'Actual Total' ,
3
3010
by: Dan | last post by:
Hello, Am trying to construct a query that'll both compute elapsed time based on certain criteria and sum this up for a subset of records. Sample Data that I'm working with: Row Ev_Time Ev_id Ev_Desc ------------------------------------------------------------------- 1 2004-12-03 14:28:45 400 Batch set Run
1
3908
by: Geir Baardsen | last post by:
Hi! I might have a difficult cuestion. In our database we have registered different tyres with different dimensions from different suppliers that is both for summer and winter season. Now I have simplified the database by having a tblCategory, so that I can run queries with this condition. So all tyres that are for summerseason, will be in the category: Tyres/su-Pirelli and tyres for
1
2630
by: Greg Strong | last post by:
Hello All, Any reason why a select query that runs will not run as an update query? What I've done is created a select query that runs successfully. The query has several custom functions to create data. When I attempt to run the query as an update query I receive an error message which reads:
6
5017
by: Dixie | last post by:
I have asked this question before, but I could not get the suggested solution work. So I will give more details this time. I have an append query that adds several hundred records to a table into a text field. Next to this text field is a separate Number (Single) field with a unique ID number for the entry. I want each number to be 1 more than the previous entry's number to keep it unique (I don't want autonumbering for this, as I...
2
1315
by: capdownlondon | last post by:
MS ACCESS 2003 Is it possible to make a query that searches a table for criteria and then updates the table deleting all of the matched in the query except for the last one (say if the records have autonumbered primary key, the one with the highest key, say). Thanks
3
1539
by: pmacdiddie | last post by:
I have this query that when run on Access 2007 works, when run in 2002 it fails with the following error: Incorrect Syntax near '.'. INSERT INTO tblQualitySurvey ( Company, Job_Num, QS_Date, First_Name, Customer_Number, Email, Job_Num_Count ) SELECT DISTINCTROW
1
2469
beacon
by: beacon | last post by:
Hi everybody, I have a combo box field in a table with a number data type that has a row source to another table that has the text value for the item selected. Now, in one of my queries, I would like to access the text value of this field without having to add the second table to my query. Is that possible? I've done it in forms and reports using the .Text or .Column property, but I'm not seeing that has an option in the Expression...
0
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9562
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8255
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.