473,385 Members | 1,817 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,385 software developers and data experts.

swap rows and columns in select query output

Is it possible to swap rows and columns in select query output so that
each record's data is displayed in a column? I want to collect data
each day and display it in a query with each day's date along the top
row and the data items below it. This would give a better appreciation
of changes over time. I apologise if I'm missing something obvious.

Phil

Nov 20 '06 #1
1 5939

"Phil" <pb****@med.usyd.edu.auwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Is it possible to swap rows and columns in select query output so that
each record's data is displayed in a column? I want to collect data
each day and display it in a query with each day's date along the top
row and the data items below it. This would give a better appreciation
of changes over time. I apologise if I'm missing something obvious.
For a Table with three Fields: DateOfData, IdentificationOfTheItem, and the
ValueOfTheItem.

Create a Query, using the QueryBuilder, with DateOfData,
IdentificationOfTheItem, and the ValueOfTheItem in the Grid. Then, in the
menu, Query | Crosstab Query, and in the Crosstab row of the grid, choose
"Column Heading" for DateOfData, "RowHeading" for IdentificationOfTheItem,
and "Value" for ValueOfTheItem.

Leave the "Total" row as "GroupBy" for DateOfData and
IdentificationOfTheItem, and the appropriate type for ValueOfTheItem.

Run the Query. Save the Query. You can use it as RecordSource of a Form or
Report if you want. You can add criteria to the Fields, if you want (and
you will, in time, as you will end up with a lot of dates unless you limit
them).

Or, if you are using Access 2002 or later, you can just create a select
Query with the three Fields, then select View, and choose Pivot Table, then
drag the Field from the Field list to the Column, Row, and Value areas -- if
all you want to do is, once in a while, review and analyze the information.

Larry Linson
Microsoft Access MVP

Nov 20 '06 #2

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; ...
6
by: Doug Baroter | last post by:
What is a good method/mechanism to swap the position of multiple columns? For instance, tblXZY has the followings columns and respective positions: tblXZY ====== xyzUUID 1 fn 2 ln 3...
7
by: Pooj | last post by:
have a urgent requirement. Please somebody help me. I have a table departinfo with following records begin_time end_time Name Pieces 10:00 10:15 PopCorn ...
2
by: Fabio | last post by:
Hello, is there any quite easy solution for the problem of transposing the rows into the columns? I have the following table with some data in it: dealer date 09.00 10.00 11.00 ...
3
by: ambersaria420 | last post by:
Hi All, I need to help with converting rows to columns in SQL2k. Input: Id Name Role 58 Ron Doe Associate 58 Mark Bonas Doctor 59 Mike Johnson Doctor
0
by: Kevin Bartz | last post by:
-----Original Message----- From: Kevin Bartz Sent: Monday, August 09, 2004 10:37 AM To: 'mike@thegodshalls.com' Subject: RE: Out of swap space & memory Thanks for your reply, Mike!...
2
by: scott.k.fraley | last post by:
....and the SELECT thats trying to pull from said Query doesn't like it one bit! ;) I'm working on this project (in Access 2002) and there is a report who's RecordSource is the following...
4
by: esmith2112 | last post by:
I have a situation that I can't explain. Boiled down to its essence, I have a query of the form SELECT A.COL1, A.COL2, B.COL1 FROM A LEFT JOIN B ON A.KEY = B.KEY This query produces 5383...
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...

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.