Viewing 15 posts - 76 through 90 (of 105 total)
because that's what I do when I am learning:-P. Thank you for that. I would not have thought of it and it helps my learning. Sooooo appreciate...
January 23, 2012 at 1:42 pm
You are correct!:laugh: So happy! Thank you so much!
---corrected query
select c.cus_code, i.inv_number, round(SUM(line_units * line_price), 2)as "Invoice Total"
from line l
join invoice i
on l.inv_number = i.inv_number
join customer c
on i.cus_code = c.cus_code
group...
January 23, 2012 at 11:48 am
Well, now it is working. It isn't that I hadn't tried grouping only by inv_number before, but that before I was getting an error unless I included the columns that...
January 23, 2012 at 6:06 am
Pardon, I mean this query
select inv_number, round(SUM(l.line_units * p.p_price), 2)as "Invoice Total"
from line l
join product p
on l.p_code = p.p_code
group by inv_number, l.line_units, p.p_price;
---results
inv_numberInvoice Total
10019.95
100114.99
10029.98
100338.95
100339.95
100374.95
100419.9
100414.97
100570.44
10069.95
1006109.92
1006256.99
How to change it so that...
January 23, 2012 at 1:33 am
Paul,
Am I not to use group by and over(partition by) together?
Unfortunately, I don't see the answer, myself, yet.
---took away the edit and over(partition by)
select inv_number, round(SUM(l.line_units * p.p_price)as...
January 22, 2012 at 9:51 pm
adding distinct, helped.
---as follows
select distinct inv_number, round(SUM(l.line_units * p.p_price) over (partition by inv_number), 2) as "Invoice Total"
from line l
join product p
on l.p_code = p.p_code
group by inv_number, l.line_units, p.p_price;
But, why doesn't...
January 22, 2012 at 5:43 pm
One more. Again, what do I need to tweak here so that inv_number appears only once?
select inv_number, round(SUM(l.line_units * p.p_price) over (partition by inv_number), 2) as "Invoice Total"
from line l
join...
January 22, 2012 at 5:35 pm
"Windowing" is a new term for me.
Thanks again, Evil Kraig.
January 22, 2012 at 3:59 pm
Evil Kraig,
That works well. I don't detect extra rows or anything.
I am making things complicated withthe Over and Partition By, I can see.
Need to makes sense and be able to...
January 22, 2012 at 11:55 am
If you'd like me to repost I will. For me this is all a variation on group by, until I see how you've answered the question. Sure, I'll start a...
January 21, 2012 at 4:31 pm
Drew, I read what you said about starting a new thread. With deference to your seniority on this forum, may I disagree? I think it is good to keep...
January 20, 2012 at 6:40 pm
Good results:
RobSinclaire212671777
LabanMeese212671777
LarryBechold213456123
BarryYoung213456123
January 20, 2012 at 1:15 pm
oh, I see, Rowcount is reserved word for use as a function.
January 20, 2012 at 1:11 pm
will you please be explicit? The subquery alone doesn't work:
select fname
,lname
...
January 20, 2012 at 1:06 pm
Hi Drew,
That query generates this:
Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword 'RowCount'.
January 20, 2012 at 11:13 am
Viewing 15 posts - 76 through 90 (of 105 total)