Solved

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

Posted on 2011-09-06
2
224 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 350 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 150 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

705 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