Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
haroon2k9
Constraint Violating Yak Guru
328 Posts |
Posted - 2009-10-14 : 07:29:41
|
| Hi all,Lets say i have tbl as follows:Id name1 A,B2 A3 C,A4 B,C,A5 ALike Abv tbl,"A" has repeated 5 times.i need a query to find out A how many times to be repeated in the table.pl help me how to do this. |
|
|
cipriani1984
Constraint Violating Yak Guru
304 Posts |
Posted - 2009-10-14 : 08:00:31
|
lets give this a goselect sum(a_count) AS a_finalcountfrom (select id, name, case when (name like '%a%') THEN 1 else 0 end as a_countfrom table_name) AS Ais this what your after? Gives you just a count of how many times A appears on whole table.quote: Originally posted by haroon2k9 Hi all,Lets say i have tbl as follows:Id name1 A,B2 A3 C,A4 B,C,A5 ALike Abv tbl,"A" has repeated 5 times.i need a query to find out A how many times to be repeated in the table.pl help me how to do this.
|
 |
|
|
|
|
|