Unfortunately, that will only give me the number of referer's for ONE
UserID.  I need the number of referer's for EACH of the User's returned in
one SQL Statement.


Thanks though.


Sincerely,

Dave Phillips
94percent.com
[EMAIL PROTECTED]
615-746-3851

"Why do 100% of the work when we'll do 94% of it for you?" -
http://honor.94percent.com

  _____  

From: Cutter (CF-Talk) [mailto:[EMAIL PROTECTED]
Sent: Friday, July 30, 2004 8:31 PM
To: CF-Talk
Subject: Re: SQL Help Please?

Maybe I'm misunderstanding what you are trying to do, but try this

Select count(Referer) as refcount
>From myTable
Where Referer = #myUserID#

Cutter

Dave Phillips wrote:

> Hi guys,
>
> I hope this isn't too far off topic, but I'm stuck on an SQL issue and
> really need some help.
>
> I have a table with these two fields:
>
> UserID  (int)
> Referer (int)
>
> UserID is obviously my user's ID number.  Referer refers to the UserID
> of the person who referred them.  
>
> I need to run an SQL Query that returns to me the total number of
> records in which a UserID is in the Referer.  
>
> For example, Ted is UserID 1 and John is UserID 2
>
> Ted Refers, Jan, Jerry and Jack
>
> John Refers Mary and Bill
>
> I now have 7 records, all unique UserID's but the referer for Jan, Jerry
> and Jack is 1 and the referer for Mary and Bill is 2
>
> I want to run an SQL Query that returns the following results:
>
> UserID   NumReferred
> 1        3
> 2        2
>
> I know it's GOT to be possible to do it all in SQl.  I know I can do it
> in CF with no problem by looping over my userid list, but that takes way
> too long.
>
> Any ideas?
>
> Thanks!
>
> Dave
>
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to