Advertisement

05.29.2007 at 05:34AM PDT, ID: 22599373
[x]
Attachment Details

Scalar Distinct Count with Group By

Asked by Ape in Databases Miscellaneous, MS SQL Server

Tags: count, distinct, group

I am trying to get a total unique number of click-throughs for given email campaigns.  A unique click-trough being a unique URL clicked by a unique user.  I need to be able to do this in a single query.  The database structure is something like:

id
campaign_id
url_id
user_id

I've been playing round but haven't been able to get this working.  E.g.

SELECT COUNT(DISTINCT url_id) FROM click_throughs WHERE campaign_id=24 GROUP BY user_id

I would need the sum of the results set this returns. But I effectively just want a single value returning.Start Free Trial
[+][-]05.29.2007 at 05:37AM PDT, ID: 19171752

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2007 at 05:38AM PDT, ID: 19171758

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2007 at 05:50AM PDT, ID: 19171829

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2007 at 06:55AM PDT, ID: 19172229

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2007 at 07:18AM PDT, ID: 19172401

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2007 at 07:33AM PDT, ID: 19172496

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2007 at 08:01AM PDT, ID: 19172692

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2007 at 08:18AM PDT, ID: 19172825

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2007 at 08:41AM PDT, ID: 19173056

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2007 at 08:48AM PDT, ID: 19173131

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2007 at 09:12AM PDT, ID: 19173348

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2007 at 09:14AM PDT, ID: 19173368

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2007 at 09:52AM PDT, ID: 19173693

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Databases Miscellaneous, MS SQL Server
Tags: count, distinct, group
Sign Up Now!
Solution Provided By: Ape
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32