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

MS Access Query

Hi, can anyone help me how to do this query from a table in MS Access.
Table name: A
date | fclass | trx_type | trx_amount
5/2 1 a 57.02
5/2 1 b 60.35
5/3 5 t 41.50
5/4 2 p 49.60
5/5 9 c 55.90

I need to run a query so that it should look like this;

date (group by) | fclass (group by) | trx_amount (sum where trx_type =
a) | trx_amount (sum where trx_type = b) | trx_amount (sum where
trx_type = t) | trx_amount (sum where trx_type = c) | trx_amount (sum
where trx_type = t) | trx_amount (sum where trx_type = p)

Thanks for your help.

Nov 13 '05 #1
2 1638
What you need is a Transform (Crosstab) query. Try the following SQL:

TRANSFORM Sum(A.trx_amount)
SELECT A.date, A.fclass
FROM A
GROUP BY A.date, A.fclass
PIVOT A.trx_type;
"suya" <su*******@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi, can anyone help me how to do this query from a table in MS Access.
Table name: A
date | fclass | trx_type | trx_amount
5/2 1 a 57.02
5/2 1 b 60.35
5/3 5 t 41.50
5/4 2 p 49.60
5/5 9 c 55.90

I need to run a query so that it should look like this;

date (group by) | fclass (group by) | trx_amount (sum where trx_type =
a) | trx_amount (sum where trx_type = b) | trx_amount (sum where
trx_type = t) | trx_amount (sum where trx_type = c) | trx_amount (sum
where trx_type = t) | trx_amount (sum where trx_type = p)

Thanks for your help.

Nov 13 '05 #2
Thanks. Using a crosstab query gives the result that I wanted. Is there
a way to save this result in a new table? Something like using a 'make
tabele query'?

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3

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

Similar topics

8
by: Frnak McKenney | last post by:
Back when computer dinosaurs roamed the earth and the precursors to today's Internet were tiny flocks of TDMs living symbiotically with the silicon giants, tracking access to data processing...
1
by: Joris Kempen | last post by:
Hi people, I know that the question has come around sometimes: How to open an Access Report using ASP and export it to for example RTF. I'm trying to implement the first method of David...
14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
4
by: bhbgroup | last post by:
I have a query on one large table. I only add one condition, i.e. a date (the SQL reads like 'where date > parameterdate'. This query is rather quick if 'parameterdate' is either explicitly...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
4
by: tt40 | last post by:
Anyone know how to prevent Access 2002 from automatically breaking all the incorrect joins in a query and then automatically saving the broken query? This is what I would call stupid design...
6
by: InnoCreate | last post by:
Hi everyone. I've recently written a classic asp website which uses an MS Access datasource. I know this is less than an ideal data source as it has limited functionality. I have a search form on...
3
by: mnjkahn via AccessMonster.com | last post by:
I'm running Access 2003, modifying a query that has over 45 fields. When I right click on the field name in Query Design View, and then click Build, Access crashes before the Build window...
6
by: jsacrey | last post by:
Hey everybody, got a secnario for ya that I need a bit of help with. Access 97 using linked tables from an SQL Server 2000 machine. I've created a simple query using two tables joined by one...
13
by: magickarle | last post by:
Hi, I got a pass-through query (that takes about 15 mins to process) I would like to integrate variables to it. IE: something simple: Select EmplID from empl_Lst where empl_lst.timestamp between...
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: 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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.