hiI have a table with three field they are Username,S1y,S1n that S1y,S1n are boolean field and save true and false values.I want to count the number of S1y and S1n when they are true .for example if my table is thisusername s1y s1nuser1 true trueuser1 false trueit return 1 for s1y and 2 for s1n. I have a stored proc for this .PROCEDURE [dbo].[drug-ch1-report3](@username1 nvarchar(50)) AS select username,count(s1y) as s1y,count(s1n) as s1nwhere (username=@username1)group by username
this sp only count the number of record and return not the true value of them. then i changed sp to this sp :PROCEDURE [dbo].[drug-ch1-report3](@username1 nvarchar(50)) AS select username,count(s1y) as s1y,count(s1n) as s1nwhere (username=@username1)and(s1y='true') and (s1n='true')group by username
this sp return the count of record that they have s1y and s1n true togheter. but i want the number of true value for each of them.please help me.