Sql: Count unique items in a table?
-
I have the following table Table: Data Column A | Column B A | 1 A | 2 B | 3 C | 4 D | 5 D | 6 I need to count the rows in Column A where there is only a unique value. Since B, and C are the only unique values in Column A the row count should equal 2. I'm having some difficulty doing this. I thought Select Distinct would work but this is also returning single results of repeated data (so I would get A, B, C, and D)
-
Answer:
select count(*) from ( select "column A" from Data group by "column A" having count(*) =1 ) X
disdamn at Yahoo! Answers Visit the source
Other answers
select distinct from data
Shrey
Related Q & A:
- How to Display Products in a table format?Best solution by Stack Overflow
- How to add primary key from multiple table as a foreign key in a table in sql server 2008?Best solution by stackoverflow.com
- Does anyone have any unique names for a baby boy?Best solution by Yahoo! Answers
- What are some unique ways for a 13 year old girl to make some good money?Best solution by Yahoo! Answers
- What is the average cost of unique visitor to a website?Best solution by quora.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.