Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 count and top (should be easy)

Author  Topic 

Vivaldi
Constraint Violating Yak Guru

298 Posts

Posted - 2001-09-12 : 16:57:52
Hey all,

Having a brain dead moment, and need a quick fix.

I have a query that grabs all the entries for all customers.

what I initially wanted to do was just get a count of all the records, but there is one hitch, i can only count up to three records for one customer.

There has to be some combo I am missing,
I thought I could select the records that satisfy into a temp table (because its the only way I know)
and then somehow get a count.

Its gotta be simple, I am just tired and thinking of things like beer and how good it would taste with the now defunct, Swedish Bikini Team.

The code is gross so I won't post it.

But essentially
the temp table would contain
customer id | primary key of entry table

if customer shows up in temp table more than 3 times, only count 3

(i am returning an aggregate count back to calling sp)
thanks for anything

_________________________
I am 8 Beers short of a case.
Proof:
Phone Rings:
"This is your proctologist calling, we found your head."
   

- Advertisement -