sharonsql2013 (1/8/2014)
This is what I need to actually count.COUNT(*)round
from CTE1
where
( (Cte1.Roundtables = '1' OR Cte1.Roundtables= 'N/A')
AND
(CTE1.IsVideo = '1' OR CTE1.IsVideo = 'N/A'))
SO, I am trying to count the # of Roundtables which have either a number or 'N/A' ( mentioned in the CTE)
and the count of IsVideo if its a number OR ;N/A.
and then do an AND on both their respective counts.
Kindly advise
Pretty sparse on details here. Remember we can't see you screen. However I suspect you are getting 0 because your logic seems a little suspect to me. You must have a row that that RoundTables = 1 or N/A AND IsVideo = 1 or N/A.
This is the same thing as RoundTables in ('1', N/A') AND IsVideo in ('1', 'N/A'). I have a feeling that is not actually what you want though.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/