473,473 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1640
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
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,...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.