By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,589 Members | 1,114 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,589 IT Pros & Developers. It's quick & easy.

Help with a query trying to total!

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
got it thanks anyway!

Dec 20 '05 #4

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.