Hi experts,

The query only returns the value for the condition " sponsor"  = "ATC", NOT the "dws".
I checked the spelling of "dws" and it exsits  in the "adobe_data2" and it has values. So, the query should return the value for "dws".
Can you help me to check it out.


 SELECT Month(cast(date as date)) as MonthNum, datename (month, cast(date as date)) as MonthName,Year(cast(date as date)) AS YearNum,
  SUM([WidgetLoad]) AS IMPRESSIONS, 
  SUM([WidgetInteraction]) AS PENCILS,
         WHEN Cast(sum (widgetload) AS INT) = 0 THEN 0
         ELSE Cast(sum (widgetinteraction) AS FLOAT) / Cast(sum (widgetload) AS FLOAT)
       END              AS Engagement

  FROM [MakeMyDeal_com].[dbo].[adobe_DATA2] av
       INNER JOIN MakeMyDeal_com..dealer d
               ON av.dealerid = d.DealerID
  WHERE name =@DealershipName
and cast(date as date) >= @StartDate and cast(date as date) <=@EndDate
and av.sponsor in ('ATC','dws')
and av.widgettype <> 'SRP'
  group by Year(cast(date as date)), Month(cast(date as date)),av.dealerid,datename (month, cast(date as date)),   

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Are you confident that your other criteria on DealerShipName, Date, and WindgetType are not causing the values for 'dws' to be excluded from the query?

Are you using a case sensitive collation? Is the case of the data 'dws' and not 'DWS', 'Dws', etc?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tanj1035Author Commented:
You are correct. One of the criterias filtered out the 'DWS'. Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.