?
Solved

Retrieving multiple records from a dataset and listing the results on one line in a msquery statement

Posted on 2011-09-06
2
Medium Priority
?
226 Views
Last Modified: 2012-05-12
I have a table that has multiple  event records for one member. Is there a way in a MsQuery statement to loop through 10 times to get the next record in a set. A simplistic look at what I want to see is:
    Member1, Event1,Event2,Event3,Event4,Event5,Event6,Event7,Event8,Event8,Event9
    instead of:
    Member1 Event1
    Member1 Event2
    Member1 Event3
    Member1 Event4
    Member1 Event5
    Member1 Event6
    Member1 Event7
    Member1 Event8
    Member1 Event9
    Member1 Event10
   
0
Comment
Question by:morinia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 1400 total points
ID: 36492848
if you are using mysql, you have the group_concat operator, but I think you are using MS Query and MSSQL as a back end. In that case, you have to make a subquery and concatenate all the results. See this link:

http://databases.aspfaq.com/general/how-do-i-concatenate-strings-from-a-column-into-a-single-row.html
0
 
LVL 22

Assisted Solution

by:Flyster
Flyster earned 600 total points
ID: 36492891
I'm not sure about the query, but if your results are appearing in excel as listed above, you can copy it, selct paste special and select transpose. This will give you the result you're looking for. You can use a macro like this:

Sub Transpose()
Range("A1:B10").Select '<Select the copy range here
    Selection.Copy
    Sheets("TragetSheetName").Select 'Set destination range here
    Range("TargetCell").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
End Sub

0

Featured Post

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 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