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

Home Posts Topics Members FAQ

Help with a query trying to total!

I have the following sql query listed below. I show the out put be low
that. I am trying to get this query to toatl and only show the line of
information with the total on it. Do you have any ideas?
SELECT ReserveWithPrice.reservationid, ReserveWithPrice.Site,
ReserveWithPrice.SitePrice, MyQuery.Total
FROM ReserveWithPrice INNER JOIN [SELECT Reservationid,
Sum(ReserveWithPrice.SitePrice) As Total
FROM ReserveWithPrice GROUP BY ReserveWithPrice.Reservationid]. AS
MyQuery ON ReserveWithPrice.Reservationid = MyQuery.id
ORDER BY ReserveWithPrice.Reservationid;

Table results

reservationid Site SitePrice Total
101 RV3 $25.00 $25.00
101 RV3 $25.00 $50.00
101 RV3 $25.00 $50.00
101 RV2 $25.00 $25.00
101 RV2 $25.00 $50.00
101 RV2 $25.00 $50.00
I would like to see the following:

reservationid Site SitePrice Total
101 RV3 $25.00 $50.00
101 RV2 $25.00 $50.00

Also the query prompts me for the MyQuery.ID Can't figure out why it's
doing thta either.
If anyone has any ideas please let me know.

Thanks
Dan

Dec 19 '05 #1
5 1247
On 19 Dec 2005 15:44:51 -0800, "deercreek" <da*@deercreekcg.com>
wrote:
I have the following sql query listed below. I show the out put be low
that. I am trying to get this query to toatl and only show the line of
information with the total on it. Do you have any ideas?
SELECT ReserveWithPrice.reservationid, ReserveWithPrice.Site,
ReserveWithPrice.SitePrice, MyQuery.Total
FROM ReserveWithPrice INNER JOIN [SELECT Reservationid,
Sum(ReserveWithPrice.SitePrice) As Total
FROM ReserveWithPrice GROUP BY ReserveWithPrice.Reservationid]. AS
MyQuery ON ReserveWithPrice.Reservationid = MyQuery.id
ORDER BY ReserveWithPrice.Reservationid;

Table results
Do you mean query results? Or is this your original table?
reservationid Site SitePrice Total
101 RV3 $25.00 $25.00
101 RV3 $25.00 $50.00
101 RV3 $25.00 $50.00
101 RV2 $25.00 $25.00
101 RV2 $25.00 $50.00
101 RV2 $25.00 $50.00
I admit to being completely confused as to what you are attempting to
do, and why. Seems like a familiar state for me today.

How come total stops at $50? I would think it should go up to $75.
And it should be $75 on all six of the rows, shouldn't it?
I would like to see the following:

reservationid Site SitePrice Total
101 RV3 $25.00 $50.00
101 RV2 $25.00 $50.00
I admit to being completely confused as to what you are attempting to
do, and why. Seems like a familiar state for me today. But I doth
repeat myself.
Also the query prompts me for the MyQuery.ID Can't figure out why it's
doing thta either.


This one I think I can suss. Shouldn't it be MyQuery.reservationid?

And if it prompts you, what do you respond to get it to display the
above information? I'm guessing 101. Is that the only reservationid
you have in the entire system? Don't you want to see this "result"
for more than just one reservationid at a time?

mike
Dec 20 '05 #2
The reservation id helped thanks. Stared and stared just couldn't see
it.
The results are query results. Anyway I want to get a running total
more or less. What ever a total would be for a specifc reservationid
with specific sites. I don't want duplicates to show though and only
the lines that have the total.

Dec 20 '05 #3
got it thanks anyway!

Dec 20 '05 #4
yes it is the query results. I am trying to get a running total of what
ever the site price is for a particular reservationid. But I do not
want duplicate rows of infor just the row that shows the total and
specfifc site like listed below.

Dec 20 '05 #5
On 19 Dec 2005 17:01:12 -0800, "deercreek" <da*@deercreekcg.com>
wrote:
yes it is the query results. I am trying to get a running total of what
ever the site price is for a particular reservationid. But I do not
want duplicate rows of infor just the row that shows the total and
specfifc site like listed below.


But you got the answer you were looking for yourself, 37 minutes
before you posted this.

BTW, when you solve something yourself you might consider posting the
solution.

mike

Dec 20 '05 #6

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

Similar topics

2
by: Alexandre MELARD | last post by:
Hi, My name is alexandre, I am 4th year student at the Napier university of edinburgh. I am finishing my year and do a presentation of my honours project next wednesday (the 5th of May). I am...
3
by: Greg | last post by:
I am trying to figure out how to create a report that will return orders current, over 30, over 60, over 90, and over 120. In one table I have Cust_Code, INV_Date, INV_Due_Date, INV_Bal and in...
4
by: Laura | last post by:
Here's the situation: I'm trying to use an update query to copy data from one row to another. Here is the situation: I have 5 companies that are linked to each other. I need to show all 5...
1
by: prabhukalyan | last post by:
Hi all, I am not so good in queries. here is my problem 2 tables to store the received items (fabric)-- inwardmaster, inwarddetails and after some processing (Dyeing) the items were...
47
by: Jo | last post by:
Hi there, I'm Jo and it's the first time I've posted here. I'm in process of creating a database at work and have come a little unstuck.....I'm a bit of a novice and wondered if anyone could...
5
by: bpbull | last post by:
SQL Server 2003 - SQL Query Analyzer. We have a database that stores service tickets and a table called non_part_usage. In this table, we have one field called request_id, one field called...
15
by: jadeverell | last post by:
Hi, I am having a slight (but very annoying) problem with a query I am trying to create. I will try to explain what I am doing as best I can…… I have 3 tables, one is Maintenance contracts, one...
1
by: enonem12 | last post by:
Here is the info:Query 2: Show all orders from London. Display supplier number, part number and quantity. Query 3: Show the total number of units ordered from each supplier. Display supplier...
4
by: mattehz | last post by:
Hey there, I am trying to upload old source files and came across these errors: Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_html.php on line 59...
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
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
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: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.