473,738 Members | 8,848 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5967

"Phil" <pb****@med.usy d.edu.auwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.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, IdentificationO fTheItem, and the
ValueOfTheItem.

Create a Query, using the QueryBuilder, with DateOfData,
IdentificationO fTheItem, 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 IdentificationO fTheItem,
and "Value" for ValueOfTheItem.

Leave the "Total" row as "GroupBy" for DateOfData and
IdentificationO fTheItem, 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
2105
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; mysql_connect('localhost','',''); mysql_select_db('test'); $query = "SELECT stuff FROM mystuff ORDER BY stuff";
6
9570
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 phone 4
7
23501
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 3 10:15 10:30 Biscuits 5 10:30 10:45 PopCorn 2
2
4722
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 12.00 13.00 14.00 ----------------------------------------------------------------- 1 2004-10-01 1/1 2/3 3/3 3/4 4/5 0/3 1 2004-10-02 0/1 1/3 1/3 1/4 3/5 1/3
3
4786
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
2467
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! Theoretically, I should need only six of the columns, but as a means of verifying integrity, I would like to de-dup using all the columns. For instance, if there are two rows identical everywhere but some column outside the six, I would like to know about...
2
2537
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 SELECT; SELECT xTab.FirstOfPRIORITZTN_STATUS_NAME, xTab., iif(IsNull( xTab. ), 0, xTab.) AS ,
4
1545
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 rows of output. Because B.COL1 was defined as VARCHAR(2000), it was making my ouput file too hard to browse so I eliminated it from the select clause.
4
3076
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 as question numbers) - The Survey Extra Results (As additional questions can be listed into the Questions table, has 3 columns (a link/id to the survey id, a link/id to the question id, and the answer the user gave).
0
9476
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8210
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.