Viewing 15 posts - 21,721 through 21,735 (of 26,484 total)
And it should be noted, that both of my rewrites using the derived table and CTE are equivalent to my original code using the HAVING clause.
Also, arun.sas, in your code...
March 31, 2009 at 5:10 am
arun.sas (3/30/2009)
Hi,Try this
select a.weekno,b.invtotal
from
invoices as a,
(
select weekno,sum(gross) as invtotal
from invoices
group by weekno
)as b
where
a.weekno = b.weekno
and b.invtotal > 10000
ARUN SAS
As this is SQL Server 2005, you really...
March 30, 2009 at 10:59 pm
RBarryYoung (3/30/2009)
Hey, Lynn got to use HAVING! Wohoo! 😛I think that we ought to award a prize anytime someone gets to use HAVING legitimately. 😀
You know, if I...
March 30, 2009 at 10:17 pm
Looks like you need to use the Latin1_General_BIN or Latin1_General_BIN2 collation to get the sort order you want. My test code:
select * from (
select 'Pr1' as Title union all
select...
March 30, 2009 at 4:35 pm
It is one way. I'm still wondering what your collation is on your system. Latin1_General_BIN2 is a case sensitive collation. Your server may be using a case...
March 30, 2009 at 4:25 pm
What is your system/database collation? It works fine on my system, collation Latin1_General_BIN2.
March 30, 2009 at 4:15 pm
Try this:
select
weekno,
sum(gross) as invtotal
from
invoices
group by
weekno
having
sum(gross) > 10000
order by
...
March 30, 2009 at 4:08 pm
Jeff Moden (3/30/2009)
Lynn Pettis (3/30/2009)
Jan Van der Eecken (3/30/2009)
March 30, 2009 at 3:57 pm
Jack Corbett (3/30/2009)
Lynn Pettis (3/30/2009)
Jack Corbett (3/30/2009)
Lynn Pettis (3/30/2009)
Jan Van der Eecken (3/30/2009)
March 30, 2009 at 3:52 pm
Jack Corbett (3/30/2009)
Lynn Pettis (3/30/2009)
Jan Van der Eecken (3/30/2009)
March 30, 2009 at 3:42 pm
Bob Hovious (3/30/2009)
Lynn!! Lynn!! I actually had someone say they had an "ah-hah" moment... with respect to setting...
March 30, 2009 at 3:39 pm
Actually, it's called anticipating where play is going so that you can be there to make (or not make) the appropriate call.
We aren't out there to call the doubtful or...
March 30, 2009 at 3:30 pm
Look carefully at the clustered index. That is what makes this work. Based on your sample data and expected results it is actualy based on BatchNo, ColID.
Edit:
Unfortunately, the...
March 30, 2009 at 3:27 pm
This is the "Water Cooler", all topics are fair game here.
March 30, 2009 at 3:24 pm
Viewing 15 posts - 21,721 through 21,735 (of 26,484 total)