473,399 Members | 2,146 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,399 software developers and data experts.

complex query question

hello,
i dont know if what i want to do is really considered complex, but i
sure cannot figure it out.
i need to create a query that shows the payments a person makes every
day for a variable date range.
for THIS example the date range is 5/1/2004 - 5/4/2004 (day1-day4)

The original table has 3 feilds :ID, DATE, PAYMENT

ID\ DATE \ PAYMENT
-------------------
1 \ 5/1/2004\ $5.00
1 \ 5/2/2004\ $3.00
1 \ 5/3/2004\ $10.00
1 \ 5/4/2004\ $4.00
----------------------
2 \ 5/1/2004\ $3.00
2 \ 5/2/2004\ $2.00
2 \ 5/3/2004\ $11.00
2 \ 5/4/2004\ $7.00
----------------------
5 \ 5/1/2004\ $8.00
5 \ 5/2/2004\ $5.00
5 \ 5/3/2004\ $9.00
5 \ 5/4/2004\ $9.00

the query will show the payments the ID has made each day. for days:
5/1/2004 - 5/4/2004 (day1-day4)

ID \ DAY1 \ DAY2 \ DAY3 \ DAY4
-----------------------------------
1 \ $5.00\ $3.00\ $10.00\ $4.00
2 \ $3.00\ $2.00\ $11.00\ $7.00
5 \ $8.00\ $5.00\ $9.00 \ $9.00
How would you go about making such a query?
Any help would be highly appreciated
thanks
Gil
Nov 12 '05 #1
1 1133
Giloosh wrote:
hello,
i dont know if what i want to do is really considered complex, but i
sure cannot figure it out.
i need to create a query that shows the payments a person makes every
day for a variable date range.
for THIS example the date range is 5/1/2004 - 5/4/2004 (day1-day4)

The original table has 3 feilds :ID, DATE, PAYMENT

ID\ DATE \ PAYMENT
-------------------
1 \ 5/1/2004\ $5.00
1 \ 5/2/2004\ $3.00
1 \ 5/3/2004\ $10.00
1 \ 5/4/2004\ $4.00
----------------------
2 \ 5/1/2004\ $3.00
2 \ 5/2/2004\ $2.00
2 \ 5/3/2004\ $11.00
2 \ 5/4/2004\ $7.00
----------------------
5 \ 5/1/2004\ $8.00
5 \ 5/2/2004\ $5.00
5 \ 5/3/2004\ $9.00
5 \ 5/4/2004\ $9.00

the query will show the payments the ID has made each day. for days:
5/1/2004 - 5/4/2004 (day1-day4)

ID \ DAY1 \ DAY2 \ DAY3 \ DAY4
-----------------------------------
1 \ $5.00\ $3.00\ $10.00\ $4.00
2 \ $3.00\ $2.00\ $11.00\ $7.00
5 \ $8.00\ $5.00\ $9.00 \ $9.00
How would you go about making such a query?
Any help would be highly appreciated
thanks
Gil


The best way would be to make a cross tab query. You'll even have a
total column. Click Query/New/CrossTab (PivotTable). Follow the wizard
steps.

Nov 12 '05 #2

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

Similar topics

1
by: Paul Bramscher | last post by:
Here's one for pathological SQL programmers. I've got a table of things called elements. They're components, sort of like amino acids, which come together to form complex web pages -- as nodes...
4
by: Starbuck | last post by:
OK, first let me say that I am no DB person. But I have a user here who keeps getting this error whenever she does, whatever it is she does, with databases... A google search takes me to...
2
by: Mikel | last post by:
I am trying to get around the problem "The expression you have entered is too complex" for a select query. (The example below is not the expression that is giving me headaches.) So I am thinking...
8
by: Matt | last post by:
Hi all, Thank you for taking the time. I have a database with 45 tables on it. 44 tables are linked to a main table through a one to one relationship. My question is, is there no way i can...
0
by: schan | last post by:
Hi there, I was wondering if someone could shed some light on a problem I have no idea on how to fix. I created an Excel Add-In that uses an ADO connection to an Access database on a file...
6
by: pippapippa | last post by:
I should be most grateful for a little advice. I have used Access 2000 & latterly 2002. Am about to upgrade since it is evident that documentation, tutorials etc are more readily available in...
13
by: DDonnachie | last post by:
Hi folks, The following SQL statment works SELECT StaffHoursTable.EngName, StaffHoursTable.JobNumberShadow, ++++++ AS Norm_Hours, ++++++ AS OT_Hours,...
3
by: BUmed | last post by:
Ok let me start from the start. I have a form that has question in it and the person chooses 0 1 2 -99 for each. The form then needs to add up the numbers for the sub categories in the form. For...
0
crystal2005
by: crystal2005 | last post by:
Hi, I am having trouble with some complex SQL queries. I’ve got winestore database, taken from Web Database Application with PHP and MySQL book. And some question about queries as the following ...
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...
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
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,...

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.