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 |
|
larryg003
Starting Member
18 Posts |
Posted - 2010-06-15 : 18:41:21
|
| Suppose I have a function with two columns: A and B.A contains tags (some of which repeat) and B contains topics like "ABC", "KDH", "FSK" (some of which repeat)What is the difference between the query:select count(COLUMN_A) where [COLUMN_B] like "ABC"and select count(COLUMN_B)where(COLUMN_B) like "ABC"?if neither column is ever empty, than the two values will always be the same, right?Lastly, I wanted to run a query to count the data when the combination of topics and tags is distinct? Because both are repetitive, i get cases when the same tag and topic can be counted twice. How do I separate this?Thanks a lot!!! |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
naveengopinathasari
Yak Posting Veteran
60 Posts |
Posted - 2010-06-16 : 02:05:41
|
| Use Sub Query to get the result for your requirement.Select Count(1) From(Select COLUMN_A , COLUMN_B FROM TableNameGROUP BY COLUMN_A , COLUMN_B ) AS DDThis will return only the count which are not duplicateLets unLearn |
 |
|
|
|
|
|