Solved

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

Posted on 2011-09-06
2
222 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

735 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