Click here to Skip to main content
15,936,903 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have list of names in the table tab1,ex
name1 values
aaa 1
bbb 1
ccc 1
ddd 2

i want the output like
name1
4/3

4-no of row in the column
3-no of row having value=1

Any suggestion pls............
Posted
Comments
What have you tried and where is the problem?

1 solution

Try:
SQL
SELECT CAST(COUNT(values) AS VARCHAR) + '/' + CAST(SUM(CASE WHEN values=1 THEN 1 ELSE 0 END) AS VARCHAR) FROM tab1
 
Share this answer
 
Comments
prabhatsp 16-Dec-13 2:39am    
thks i got the answer
OriginalGriff 16-Dec-13 3:18am    
You're welcome!
Maciej Los 16-Dec-13 2:42am    
+5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900