Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2017
    Posts
    2

    Unanswered: Showing users with 0 records

    Hi,

    I'm working with a mirror of salesforce data in SQL Server 2012 and I am at the moment generating a report that shows the # of leads that were created by X user. This is easy enough to do by just doing a SELECT for the lead creator & the num of leads and creating a pivot table in excel.

    However, I would also like some report to show me which active users (which I could join from a separate user table) have created 0 leads in the last week. Is there an easy way to do this?

    My first thought was doing something like...taking the total list of active users, then comparing it against the list of users that did generate something and where they are not found, I'd have my list, but that would be very manual - ideally would like to build it into the query somehow.

  2. #2
    Join Date
    Apr 2017
    Posts
    2

    Clarification

    I don't think I did a great job of explaining the issue, I think the attached image should make it more clear.

    Click image for larger version. 

Name:	0 leads.png 
Views:	1 
Size:	42.6 KB 
ID:	17319

  3. #3
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,862
    Provided Answers: 17
    Would a left join from the Sales Leads to the Active Salespeople, and filtering for null Salespeople do the trick?

  4. #4
    Join Date
    Oct 2007
    Posts
    161
    Provided Answers: 9
    I would use something like:
    Code:
    select people_id from salespeople a
    where not exists (select from sales_leads b
                              where a.people_id = b.people_id)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •