Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2012
    Posts
    188

    Unanswered: Query Results to Only Show ONE result per locale

    My query produces accurate results just produces one instance for each sales region. I am needing it to only give me one instance of each sales region and give me total counts. What should I re-write?
    Code:
    Select
    salesmanname,
    case when [state] IN ('GA', 'FL', 'AL', 'SC', 'NC', 'TN') Then 'South'
    when [state] IN ('CA', 'NV', 'WA', 'OR', 'TX') Then 'West'
    when [state IN ('NY', 'NJ', 'PA', 'DL', 'CT') Then 'NE'
    end As [Sales Region]
    from database1
    Group By case when [state] IN ('GA', 'FL', 'AL', 'SC', 'NC', 'TN') Then 'South'
    when [state] IN ('CA', 'NV', 'WA', 'OR', 'TX') Then 'West'
    when [state IN ('NY', 'NJ', 'PA', 'DL', 'CT') Then 'NE'
    end 
    UNION ALL
    Select
    salesmanname,
    case when [state] IN ('GA', 'FL', 'AL', 'SC', 'NC', 'TN') Then 'South'
    when [state] IN ('CA', 'NV', 'WA', 'OR', 'TX') Then 'West'
    when [state IN ('NY', 'NJ', 'PA', 'DL', 'CT') Then 'NE'
    end As [Sales Region]
    from database2
    Group By case when [state] IN ('GA', 'FL', 'AL', 'SC', 'NC', 'TN') Then 'South'
    when [state] IN ('CA', 'NV', 'WA', 'OR', 'TX') Then 'West'
    when [state IN ('NY', 'NJ', 'PA', 'DL', 'CT') Then 'NE'
    end

  2. #2
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    how about show us some input data and what you expect your results to be
    Dave

Posting Permissions

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