Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2005, 05:56 AM
Ayres Ayres is offline
Novice
Access question
 
Join Date: Jun 2005
Posts: 2
Ayres is on a distinguished road
Post Access question

I am looking for a querrie that would take multiple records and populate a single field. For example.



Name Friends
Dave Bob
Dave Tom
Sally Kim
Sally Brenda

The querrie would return

Name Friends
Dave Bob, Tom
Sally Kim, Brenda

P.S. I don't know visual basic.
Reply With Quote
  #2  
Old 06-06-2005, 06:33 AM
obenix obenix is offline
Novice
 
Join Date: Apr 2005
Posts: 14
obenix is on a distinguished road
Default

Hi Ayres, welcome to the forum.
About your maiden post, could you please be more specific? What language/database exactly do you want to achieve this? Would SQL Select statement do?
Reply With Quote
  #3  
Old 06-06-2005, 07:46 AM
Ayres Ayres is offline
Novice
Access question
 
Join Date: Jun 2005
Posts: 2
Ayres is on a distinguished road
Default

I am using Access 2003. The report I am creating uses ODBC drivers to pull information directly from our company database. All my querries are created in design view.
Reply With Quote
  #4  
Old 06-06-2005, 08:44 AM
Matrix's Avatar
Matrix Matrix is offline Access question Windows 10 Access question Office 2010
Admin
 
Join Date: Jan 2005
Posts: 429
Matrix is on a distinguished road
Default

Normally I use a simple query first, then combine the queried results with programming, when the name in the next record is the same with current record, group them into one object (string, etc. according to your code), if they are different, finish current record and start a new one.

SQL query: select Name, Friends from table_name order by Name
Reply With Quote
  #5  
Old 06-06-2005, 10:12 AM
Matrix's Avatar
Matrix Matrix is offline Access question Windows 10 Access question Office 2010
Admin
 
Join Date: Jan 2005
Posts: 429
Matrix is on a distinguished road
Default

I don't think it's possible unless you have fixed number of friends for each person, like two.
Reply With Quote
  #6  
Old 06-06-2005, 10:34 PM
volcane volcane is offline
Novice
 
Join Date: Apr 2005
Posts: 12
volcane is on a distinguished road
Default

Interesting, let me check and let you know.
Reply With Quote
  #7  
Old 06-06-2005, 10:51 PM
volcane volcane is offline
Novice
 
Join Date: Apr 2005
Posts: 12
volcane is on a distinguished road
Default

Had give it a try but don't think it is possible unless you had fixed number of friend. Easy solution will be like hurricane suggest used programming to loop thru it.

If you are using PL/SQL (Oracle) then you can create a function which will return concatenated friends name as a string and used it in your query.

Edited---
This SQL will return what you want but fixed friends
SELECT DISTINCT t.name, f1.friend & ', ' & f2.friend AS friends
FROM tb t, tb f1, tb f2
WHERE t.
name = f1.name AND tname = f2.name
AND f1.friend < f2.friend;


Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiya, New guy here with a question. twincamfxd Outlook 0 09-10-2006 08:50 PM
Need help with this question... lllDNYlll Outlook 0 05-04-2006 07:17 AM
Categories question & replying with attachment question glitzymama Outlook 0 03-15-2006 09:32 AM
Access question Dumb question ExcelNewbie Excel 1 03-09-2006 04:45 PM
Access question Can Access access folders & sub-folders and dig out data? nrg Office 4 06-20-2005 11:09 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:31 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft