How to Write a SQL statement to display the repeated rows of the table below:?
-
Write a SQL statement to display the repeated rows of the table below: Field Type Null Key Default Extra doc_id varchar(1000) NO PARTIAL NO topic_id varchar(45) NO PARTIAL NO doc_headline text NO NO NO doc_text text NO NO NO
-
Answer:
Ok, I will assume that 'topic_id' is the criteria for determining if the row is repeated (i.e. topic_id is the same on two or more items). I am giving you a generic way of dealing with the problem. You can adjust the query by changing the column name if the semantics of "repeated" are different: SELECT topic_id, count(topic_id) FROM documents GROUP BY topic_id HAVING count(topic_id) > 1
susil81 at Yahoo! Answers Visit the source
Related Q & A:
- How to convert a SQL query into hibernate criteria?Best solution by Stack Overflow
- How to execute a selected statement?Best solution by Stack Overflow
- How to make a thesis statement?Best solution by Yahoo! Answers
- I have to write a personal statement. Any help?Best solution by ucas.com
- How do I write a personal statement for law school?Best solution by Yahoo! Answers
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.