473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

rows to columns query

Hi

what I am trying to do is this:

I have this:

Family Names ¦ First Names
_______________________
Family Name1 ¦ First Name1
Family Name1 ¦ First Name2
Family Name1 ¦ First Name3
Family Name2 ¦ First Name1
etc

What I need is this

Family Names ¦ FirstNameA ¦ FirstNameB ¦ FirstNameC ¦ FirstNameD ¦
__________________________________________________ ___________
Family Name1 ¦ FirstName1 ¦ FirstName2 ¦ FirstName3 ¦ FirstName4
¦
Family Name2 ¦ FirstName1 ¦ FirstName2 ¦ FirstName ¦
¦

I have almost achieved this using a Select Query with Totals, Grouping
by Family Name, and using "first" and "last" for the First Name field,
which gives me 2 first names in a row - which is OK if thats all there
are, but I need the second, third and nth first names also.
I posted this in the ms.public.access.queries forum, but the only
suggestion I got was to use a crosstab query - but I cant see how that
would work

Thanks!

Andy

Nov 23 '06 #1
4 1796
the standard, and AFAIK quickest and easiest, way to "denormalize" data for
presentation purposes, is by using a crosstab query. did you actually try
it? if so, what was the result?

hth
"Andy M" <tw********@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
Hi

what I am trying to do is this:

I have this:

Family Names ¦ First Names
_______________________
Family Name1 ¦ First Name1
Family Name1 ¦ First Name2
Family Name1 ¦ First Name3
Family Name2 ¦ First Name1
etc

What I need is this

Family Names ¦ FirstNameA ¦ FirstNameB ¦ FirstNameC ¦ FirstNameD ¦
__________________________________________________ ___________
Family Name1 ¦ FirstName1 ¦ FirstName2 ¦ FirstName3 ¦ FirstName4
¦
Family Name2 ¦ FirstName1 ¦ FirstName2 ¦ FirstName ¦
¦

I have almost achieved this using a Select Query with Totals, Grouping
by Family Name, and using "first" and "last" for the First Name field,
which gives me 2 first names in a row - which is OK if thats all there
are, but I need the second, third and nth first names also.
I posted this in the ms.public.access.queries forum, but the only
suggestion I got was to use a crosstab query - but I cant see how that
would work

Thanks!

Andy
Nov 23 '06 #2
Hi Tina,
Yes I've tried it and I can see how I could do a calculation on the
"FirstName" fields if I wanted to - showing for example the total
number of firstnames per family name, or even listing the first and
last firstname record, but that still doesnt get me a listing of every
first name in a family in one row.

Andy

I could have Family Name as a Row Title and First Name as a column
title
tina wrote:
the standard, and AFAIK quickest and easiest, way to "denormalize" data for
presentation purposes, is by using a crosstab query. did you actually try
it? if so, what was the result?

hth
"Andy M" <tw********@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
Hi

what I am trying to do is this:

I have this:

Family Names ¦ First Names
_______________________
Family Name1 ¦ First Name1
Family Name1 ¦ First Name2
Family Name1 ¦ First Name3
Family Name2 ¦ First Name1
etc

What I need is this

Family Names ¦ FirstNameA ¦ FirstNameB ¦ FirstNameC ¦ FirstNameD ¦
__________________________________________________ ___________
Family Name1 ¦ FirstName1 ¦ FirstName2 ¦ FirstName3 ¦ FirstName4
¦
Family Name2 ¦ FirstName1 ¦ FirstName2 ¦ FirstName ¦
¦

I have almost achieved this using a Select Query with Totals, Grouping
by Family Name, and using "first" and "last" for the First Name field,
which gives me 2 first names in a row - which is OK if thats all there
are, but I need the second, third and nth first names also.
I posted this in the ms.public.access.queries forum, but the only
suggestion I got was to use a crosstab query - but I cant see how that
would work

Thanks!

Andy
Nov 23 '06 #3
"Andy M" <tw********@gmail.comwrote in
news:11*********************@45g2000cws.googlegrou ps.com:
Hi Tina,
Yes I've tried it and I can see how I could do a calculation
on the "FirstName" fields if I wanted to - showing for example
the total number of firstnames per family name, or even
listing the first and last firstname record, but that still
doesnt get me a listing of every first name in a family in one
row.

Andy

I could have Family Name as a Row Title and First Name as a
column title
tina wrote:
>the standard, and AFAIK quickest and easiest, way to
"denormalize" data f
or
>presentation purposes, is by using a crosstab query. did you
actually try it? if so, what was the result?

hth
"Andy M" <tw********@gmail.comwrote in message
news:11**********************@h54g2000cwb.googleg roups.com...
Hi

what I am trying to do is this:

I have this:

Family Names ¦ First Names
_______________________
Family Name1 ¦ First Name1
Family Name1 ¦ First Name2
Family Name1 ¦ First Name3
Family Name2 ¦ First Name1
etc

What I need is this

Family Names ¦ FirstNameA ¦ FirstNameB ¦ FirstNameC ¦
FirstNameD
¦
>_________________________________________________ ____________
Family Name1 ¦ FirstName1 ¦ FirstName2 ¦ FirstName3 ¦
FirstName4 ¦
Family Name2 ¦ FirstName1 ¦ FirstName2 ¦ FirstName ¦
¦

I have almost achieved this using a Select Query with Totals,
Grouping by Family Name, and using "first" and "last" for
the First Name field,
which gives me 2 first names in a row - which is OK if thats
all there
are, but I need the second, third and nth first names also.
I posted this in the ms.public.access.queries forum, but the
only suggestion I got was to use a crosstab query - but I
cant see how that would work

Thanks!

Andy
search the web for a piece of code called fConcatChild

Create a summary or distinct query that gives you the family
name once, and add this function to return the firstnames.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Nov 23 '06 #4
ah, there you go, Andy. Bob saved the day. Happy Thanksgiving! :)
"Bob Quintal" <rq******@sPAmpatico.cawrote in message
news:Xn**********************@66.150.105.47...
"Andy M" <tw********@gmail.comwrote in
news:11*********************@45g2000cws.googlegrou ps.com:
Hi Tina,
Yes I've tried it and I can see how I could do a calculation
on the "FirstName" fields if I wanted to - showing for example
the total number of firstnames per family name, or even
listing the first and last firstname record, but that still
doesnt get me a listing of every first name in a family in one
row.

Andy

I could have Family Name as a Row Title and First Name as a
column title
tina wrote:
the standard, and AFAIK quickest and easiest, way to
"denormalize" data f
or
presentation purposes, is by using a crosstab query. did you
actually try it? if so, what was the result?

hth
"Andy M" <tw********@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
Hi

what I am trying to do is this:

I have this:

Family Names ¦ First Names
_______________________
Family Name1 ¦ First Name1
Family Name1 ¦ First Name2
Family Name1 ¦ First Name3
Family Name2 ¦ First Name1
etc

What I need is this

Family Names ¦ FirstNameA ¦ FirstNameB ¦ FirstNameC ¦
FirstNameD
¦
__________________________________________________ ___________
Family Name1 ¦ FirstName1 ¦ FirstName2 ¦ FirstName3 ¦
FirstName4 ¦
Family Name2 ¦ FirstName1 ¦ FirstName2 ¦ FirstName ¦
¦

I have almost achieved this using a Select Query with Totals,
Grouping by Family Name, and using "first" and "last" for
the First Name field,
which gives me 2 first names in a row - which is OK if thats
all there
are, but I need the second, third and nth first names also.
I posted this in the ms.public.access.queries forum, but the
only suggestion I got was to use a crosstab query - but I
cant see how that would work

Thanks!

Andy
search the web for a piece of code called fConcatChild

Create a summary or distinct query that gives you the family
name once, and add this function to return the firstnames.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Nov 24 '06 #5

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

Similar topics

1
by: aznFETISH | last post by:
Below I found a code to make multiple colums from the output of a DB, how can I incorporate alternat colors to the multiple row snippet? <?php //set the number of columns $columns = 2; ...
4
by: Support | last post by:
Hi, I want to know if I have changed a few records in my database using update / insert / delete methods, how can i later know which rows have been changed or modified ? I know the...
2
by: Gnurp Gnarp | last post by:
When the number of columns get large, it becomes increasingly difficult to view the results of a select in a small window (e.g. 80 line xterm) because of line wrapping. Can I have the results of...
7
by: Susan Bricker | last post by:
Sorry..I keep hitting the wrong key and sending the post too soon... The problem: COMBOBOX not displaying all possible rows. The RecordSource (generated by SQL view of the Query Builder) is:...
4
by: dallasfreeman | last post by:
I'm looking at a quick way to get results that are displayed as rows to display as columns. I have three tables:- - The Questions for the survey - The Results of the survey (Columns are listed...
9
by: dotnetguru | last post by:
Hi SMART GUYS, Please help me write a query. Actually I want to convert my rows into columns. Can anyone kindly give me the query to do it? My rows are about employees. There can be any number of...
2
by: Blasting Cap | last post by:
I've got a gridview (that I converted over from a datagrid, which had been working properly), that is doubling up the number of rows returned. When it was running as a datagrid, the same code sent...
5
by: Sieldan | last post by:
I'm trying to throw some data around so that I can manipulate it more easily. Unfortunately, I don't really know what I'm doing. :) So I'm creeping my way through it step by step. What I have done...
4
by: muhammadrashidmughal | last post by:
columns f1 f2 f2 f4 f5 f6 f7 f8 ...... 1 2 3 4 ...
1
by: brionesl | last post by:
Hi, I have seen other threads with the same question but I'm not too familiar with Access and their solutions often include writing VB code or very complex SQL statements. What I want to do is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...

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.